KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am very new to programming with R, but I am trying to read in multiple files for a directory and give them each a unique name. I am reading the files in using the Dendrochronology Program Library in R (package dpIR) and the read.tucson function. Although I'm using a specific package, I think my question is fairly general: Within the loop, I want to create files by concatenating a "t" with each individual files name. So, if I have a file named "2503" in my directory, I want to create a dataframe in R called "t2503" . Next, I want to read the data in using the r.tucson function to each dataframe. Rather than assigning the read-in data to the dataframe, I'm just overwriting the concatenation with the data. Can someone help me figure out what step I am missing? Here is the code I am trying to use: #set to appropriate directory setwd("C:/work") #get a list of files in the directory files <- list.files() numfiles <- length(files) for (i in 1:numfiles) { name<-paste("t",files[i],sep="") name<-read.tucson(files[i],header=NULL) }
Tags (comma-separated)
Save Edits
Cancel