It works!
Thank you.
CecÃlia
De: Scott Chamberlain [mailto:scttchamberla...@gmail.com]
Enviada: quinta-feira, 19 de Maio de 2011 13:40
Para: Cecilia Carmo
Cc: r-help@r-project.org
Assunto: Re: [R] balanced panel data
# If you know how many years are needed you could do this
# If you know how many years are needed you could do this
makenewtable <- function(x, years) {
xlist <- split(x, x$firm)
new <- list()
dat <- lapply(xlist, function(z) if(length(unique(z$year)) == years) {new <- z}
)
dat_ <- do.call(rbind, dat)
return(dat_)
}
makenewtable(finaldata, 5)
Scott
On
2 matches
Mail list logo