[R] Reshape: 'melt' numerous objects
hadley wickham
h.wickham at gmail.com
Tue Mar 31 18:41:17 CEST 2009
On Tue, Mar 31, 2009 at 11:12 AM, Steve Murray <smurray444 at hotmail.com> wrote:
>
> Dear R Users,
>
> I'm trying to use the reshape package to 'melt' my gridded data into column format. I've done this before on individual files, but this time I'm trying to do it on a directory of files (with variable file names) - therefore I have to also use the 'assign' command. I have come up against a couple of problems however and am therefore seeking advice...
I'd _strongly_ recommend you don't use assign. Instead put everything
in a list:
paths <- dir("mydir", "\\.csv$", full.names = TRUE)
names(paths) <- basename(paths)
data <- lapply(paths, read.csv)
molten <- lapply(data, melt, id = "Latitude", na.rm=TRUE)
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list