read.multiple.table | R Documentation |
Open each of a set of files assumed to represent additional cases / observations on the same set of variables, then combine them into a single data frame containing all of the cases. For example, if data from 10 research participants are in 10 separate files, they can be read and combined into a single data frame.
read.multiple.table( uniquenames, path = getwd(), prefix = "", suffix = ".txt", addfilename = FALSE, paduniquenames = FALSE, ... ) read.multiple.csv( uniquenames, path = getwd(), prefix = "", suffix = ".csv", addfilename = FALSE, paduniquenames = FALSE, ... )
uniquenames |
A vector of string filenames, or if |
path |
Optional string indicating a path ("directory" or "folder") where to be appended to the start of every filename. |
prefix |
Optional string indicating a string that should be prepended to the start of each filename. |
suffix |
Optional string indicating a string that should be appended to the end of every filename. |
addfilename |
a logical value indicating whether a 'Filename' column should be added to the resulting dataframe indicating the filename of each original file. |
paduniquenames |
a logical value indicating whether each of the elements
of |
... |
arguments to |
Data frame with the content of all of the files combined by rows.
read.table
to read from a single file.
write.csv(data.frame(StudentName=c('Duane','Scott'), GPA=c(3.90, 2.3)), file='school01.csv', row.names=FALSE) write.csv(data.frame(StudentName=c('Alison','Laurel'), GPA=c(2.90, 4.0)), file='school22.csv', row.names=FALSE) allschools <- read.multiple.csv(uniquenames=c(1,22), prefix='school', suffix='.csv', paduniquenames=TRUE) # for 01 rather than 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.