pi4-uiuc / team1-predict-swir

predicting SWIR spectral radiation
0 stars 1 forks source link

Combine rmd files #2

Open dlebauer opened 7 years ago

dlebauer commented 7 years ago

Put reading of CSV files in a for loop, bind them together, and plot all curves on the same plot.

Current redundancy is not DRY, and inconvenient to have to open different files for each dataset.

GraceJaffe commented 7 years ago

I'm having trouble with the for loop. I'm trying:

factors = c(20,48,75,95,99)

data = c()

for(i in factors){
  file = (paste0("Ref_Factor_",as.character(i),".csv"))
  data <- c(data,(read.csv(file)))
}

and it returns

cannot open file 'Ref_Factor_20.csv': No such file or directoryError in file(file, "rt") : cannot open the connection

I can see that Ref_Factor_20.csv exists in the data folder, so my guess is that I'm not specifying that I want to find it from there, but I'm not sure how to do that. I'd be happy to instead have a for loop that considers every file in the data folder, but despite googling, I'm now sure how to that either.

dlebauer commented 7 years ago

What is the output of "dir()" ?

Ogaitnos commented 7 years ago

most likely you are working from the Team_1 folder. Try "data/RefFactor",as.character(i),".csv" as the path.

klajbor2 commented 7 years ago

@GraceJaffe @Ogaitnos Has this issue been resolved? It hasn't been closed yet if so.

Ogaitnos commented 7 years ago

it has been done for the 5 sets of data that we have, but I don't want to close it until we have the larger number of observations