
R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ### Testing problematic and erroneous data
> library(plm)
> 
> ### NA in the individual index: should give an informative error
> ind <- 1:100
> ind[4] <- NA
> T <- 4
>                            # balanced panel of length 4
> alpha <- rnorm(length(ind))
>                            # fixed effects
> eps <- rnorm(T*length(ind))
>                            # idiosyncratic effect
> x <- runif(length(ind))
> y <- x + alpha + eps
> dat <- data.frame(y, x, ind=rep(ind, T), t=rep(1:T, each=length(ind)))
> data <- pdata.frame(dat, index=c("ind", "t"))
at least one couple (id-time) has NA in at least one index dimensionin resulting pdata.frame
 to find out which, use e.g.table(index(your_pdataframe), useNA = "ifany")
> a <- try(m <- plm(y ~ x, data=data, model="random"))
Error in model.matrix.pdata.frame(data) : 
  NA in the individual index variable
>                            # should give an error: NA in the individual index
> 
> proc.time()
   user  system elapsed 
  0.431   0.039   0.458 
