On Sat, Dec 26, 2009 at 10:21 AM, Maithili Shiva
<maithili_shiva@yahoo.com>wrote:
>
>
> Dear R helpers
>
> I have some files in my say 'WORK' directory and the file names are
say
> rate1.csv, rate2.csv, rate3.csv, rate4.csv
>
> Because of some other requirement, I need to run the following commands
>
> n = 4
>
> rates = NULL
>
> for (i in 1:n)
>
> rates[i] = (paste(`rate', i, ‘.csv`, sep = ‘’))
>
> # this gives me "rate1.csv" "rate2.csv" and so on
>
> #My problem is now I need to relate these file names with actual files and
> read these files
> # There are files rate1.csv, rate2.csv, rate3.csv, rate4.csv in my WORK
> directory.
>
>
> # If I individually define
>
> PPP = read.csv(‘rate[1]’)
> PPP # When I run PPP in R, it gives contents of the file rate1.csv
> i.e. I am able to read the required rate1 file. But if I run following
> commands, I get errors.
>
> newrate = NULL
>
>
Maybe try:
newrate <- list()
and leave everything else as it is.
just an idea,
> for (i in 1:n)
> {
> newrate[i] = read.csv(rates[i])
> }
>
> I need to read all these four files for my further analysis. Please guide.
>
>
> Regards
>
> Maithili
>
>
>
>
> The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@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.
>
>
[[alternative HTML version deleted]]