[R] importing multiple file form folder

Rui Barradas ruipbarradas at sapo.pt
Sun Jun 10 13:31:27 CEST 2012


Hello,

Try the following example.



#install.packages("reshape2")

library(reshape2)

d <- data.frame(D=Sys.Date()+1:5, Temp1=1:5, Temp2=6:10, Temp3=11:15)
d
dm <- melt(d, id=("D"))
dm


If this seems familiar, then in your it should be id=c("Length", "Date") 
if "Date" already is a data.frame column.

Hope this helps,

Rui Barradas

Em 10-06-2012 10:21, mpavlic escreveu:
>
> Thanks for reply Rui,
>
> this is not exactly what i need. The way you proposed i get the data
> structured like this :
>
> 	Length, TempAtLocation1, TempAtLocation2....TempAtLocationN
>
> What i'd like is to actuall get the data from each file in Columns, but they
> should be binded in rows in one table...something like this :
>
>
> 			Length, Date(or the name of each file), Temperature
> 			.
> 			.	
> 	file 1	.
> 			.
> 			.
> 			.
> 			.	
> 	file 2	.
> 			.
> 			.
> 			.
> 			.	
> 	file 3	.
> 			.
> 			.
> 			.
> 			.	
> 	file N	.
> 			.
> 			.
> 			
> In that way i would have only three columns, and each 970 inputs (rows) the
> values woud represent temperature at different date (meaning imported column
> from a new file).
>
> Any ideas?
>
> --
> View this message in context: http://r.789695.n4.nabble.com/importing-multiple-file-form-folder-tp4631637p4632929.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list