At the current moment (version 1.2-10, 2012-05-05) it seems that the unbalanced case is not supported. Edit: The issue of unbalanced panel data is solved in version 2.2-2 of plm on CRAN (2020-02-21).
Rest of the answer is assuming version 1.2-10:
I've looked at the code, and the final data preparation line (no matter what is your initial argument) is the following:
object <- as.data.frame(split(object, id))
If you pass unbalanced panel, this line will make it balanced by repeating the same values. If your unbalanced panel has time series with lengths which divide each other then even no error message is produced. Here is the example from purtest page:
> data(Grunfeld)
> purtest(inv ~ 1, data = Grunfeld, index = "firm", pmax = 4, test = "madwu")
Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )
data: inv ~ 1
chisq = 47.5818, df = 20, p-value = 0.0004868
alternative hypothesis: stationarity
This panel is balanced:
> unique(table(Grunfeld$firm))
[1] 20
Disbalance it:
> gr <- subset(Grunfeld, !(firm %in% c(3,4,5) & year <1945))
Two different time series length in the panel:
> unique(table(gr$firm))
[1] 20 10
No error message:
> purtest(inv ~ 1, data = gr, index = "firm", pmax = 4, test = "madwu")
Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )
data: inv ~ 1
chisq = 86.2132, df = 20, p-value = 3.379e-10
alternative hypothesis: stationarity
Another disbalanced panel:
> gr <- subset(Grunfeld, !(firm %in% c(3,4,5) & year <1940))
> unique(table(gr$firm))
[1] 20 15
And the error message:
> purtest(inv ~ 1, data = gr, index = "firm", pmax = 4, test = "madwu")
Erreur dans data.frame(`1` = c(317.6, 391.8, 410.6, 257.7, 330.8, 461.2, :
arguments imply differing number of rows: 20, 15