[R] Automatic File Reading

bogdan romocea br44114 at gmail.com
Wed Oct 18 19:23:15 CEST 2006


Forget about assign() & Co. Search R-help for 'assign', read the
documentation on lists, and realize that it's quite a lot better to
use lists for this kind of stuff.


> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Scionforbai
> Sent: Wednesday, October 18, 2006 12:04 PM
> To: Lorenzo Isella
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Automatic File Reading
>
> Just to complete: if you need them all at the same time:
>
> for(i in 1:100)
> {
>   fn <- paste("velocity",i,".txt",sep="")
>   varname <- paste("velocity",i,sep="")
>   assign(varname,read.csv(fn))
> }
>
> and you have a list of objects {velocity1, ..., velocity100} with
> corresponding data.
>
> Scionforbai
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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