Re: [R] reading in multiple data sets in 2 loops

2016-02-07 Thread Reka Howard
Thank you very much for all of the help!!! For what I need, Jim's and Jeff's solutions were the most useful, but I really appreciate all of the help I got. On Sat, Feb 6, 2016 at 2:01 PM, Jeff Newmiller wrote: > Normally one wants not only to read the data, but to save it in an object > as well.

Re: [R] reading in multiple data sets in 2 loops

2016-02-07 Thread Marc Girondot
Try this: # install package HelpersMG from CRAN including dependencies install.packages("HelpersMG") # Update to the lastest version install.packages("http://www.ese.u-psud.fr/epc/conservation/CRAN/HelpersMG.tar.gz";, repos=NULL, type="source") # Use the function read_folder() library("Helpers

Re: [R] reading in multiple data sets in 2 loops

2016-02-06 Thread Boris Steipe
Computing filenames is a dangerous, backwards approach. If you already _have_ files, it's wrong to create filenames from assumptions. Rather you need to capture the existing filenames with an appropriate use of list.files(), and then process that vector. Computing filenames only has a place when

Re: [R] reading in multiple data sets in 2 loops

2016-02-06 Thread William Dunlap via R-help
I tried the following but it does not work: data <- lapply( paste(("C:/Research3/simulation1/second_gen/pheno_ 1000ind_4000m_add_h70_prog_",[1:2],"_",[2:3],".csv",sep=''), read.csv, header=TRUE, sep=',' ) names(data) <- paste("d", LETTERS[1:3], sep='') I tried that and R comp

Re: [R] reading in multiple data sets in 2 loops

2016-02-06 Thread Jeff Newmiller
Normally one wants not only to read the data, but to save it in an object as well. Here are some modifications toward achieving that (untested): header<-"C:/Research3/simulation1/second_gen/pheno_1000ind_4000m_add_h70_prog" fnums <- expand.grid( a = 1:2, b = 2:3 ) result <- vector( "list", nrow(

Re: [R] reading in multiple data sets in 2 loops

2016-02-06 Thread Jim Lemon
Hi Reka, Try this: header<-"C:/Research3/simulation1/second_gen/pheno_ 1000ind_4000m_add_h70_prog" for(index1 in 1:2) { for(index2 in 2:3) read.csv(paste(paste(header,index1,index2,sep="_"),".csv",sep="")) } Jim On Sat, Feb 6, 2016 at 4:53 PM, Reka Howard wrote: > Hello, > I have over 1000

[R] reading in multiple data sets in 2 loops

2016-02-05 Thread Reka Howard
Hello, I have over 1000 csv data sets I need to read into R, so I want to read them in using a loop. The data sets are named as pheno_1000ind_4000m_add_h70_prog_1_2.csv, pheno_1000ind_4000m_add_h70_prog_1_3.csv, ... so I need 2 loops (for the last 2 numbers in the names). What I would like to do is