# Import several text files

#### ricwoo89

##### New Member
I am beginning to use R after a long stint with MATLAB and have come across a problem. I apologise in advance for the simplicity of this question.

Consider the following example:

Code:
TopFolder = "E:\\University"
SubFolder = list.files(TopFolder)
PathName = paste(TopFolder,SubFolder,"temp.txt",sep="\\")
This code specifies the pathname for each text file I would like to import into R. The text files contain 8760 rows and 12 or 11 column (i.e. the number of columns vary). I would like to import this data in a similar format as a cell array in MATLAB where each text file would correspond to a cell. I have attempted the following:

Code:
temp = lapply(PathName, read.table)
This works to a certain extent although I am unsure about how to use the data from here. I'm am hoping to eventually convert the data into a time series. Note: the data is temperature measurements measured at various heights where each column is a different height and each represents time.

#### trinker

##### ggplot2orBust
This works to a certain extent
What does this mean?

although I am unsure about how to use the data from here.
You don't have a data frame at this point you have a list of data frames. You can access the data frames in this list with:
Code:
temp[[1]]
where the number in the indices is the first data frame in the list of data frames you created with lapply (that's what the 'l' in lapply stands for; list apply).