loadcsv_multi {easycsv}R Documentation

read multiple csv files into named data frames

Description

Reads multiple files in table format and creates a data frame from them, with cases corresponding to lines and variables to fields in the file.

Usage

loadcsv_multi(directory = NULL,
                          extension = "CSV",
                          encoding = "Latin-1",
                          stringsAsFactors = FALSE,
                          header = TRUE,
                          quote = "\"",
                          fill = TRUE,
                          comment.char = "")


Arguments

directory

a directory to load the files from, if NULL then a manual choice is provided on windows OS.

extension

logical. if TRUE .txt files will be loaded as tables instead of .csv.

encoding

character. files encoding. default is Latin-1

stringsAsFactors

logical: should character vectors be converted to factors? Note that this is overridden by as.is and colClasses, both of which allow finer control.

header

a logical value indicating whether the files contain the names of the variables as its first line. If missing, the value is determined from the file format: header is set to TRUE if and only if the first row contains one fewer field than the number of columns.

quote

the set of quoting characters. To disable quoting altogether, use quote = "". See scan for the behavior on quotes embedded in quotes. Quoting is only considered for columns read as character, which is all of them unless colClasses is specified.

fill

logical. If TRUE then in case the rows have unequal length, blank fields are implicitly added.

comment.char

character: a character vector of length one containing a single character or an empty string. Use "" to turn off the interpretation of comments altogether.

Details

loadcsv_multi is used for uncompressed files in a single folder.it can be used either by entering the local directory the files are in, or just running it with no arguments for manual folder selection on windows OS. It receives some arguments from read.csv and they are listed in the arguments section. loadcsvfromZIP is used for comma separated tables inside of a .zip file. loadZIPcsvfromURL is used for comma separated tables inside of a .zip file on the internet, no download needed.

Value

A data.frame containing a representation of the data in the file.

See Also

loadZIPcsvfromURL loadcsvfromZIP

Examples

  require(easycsv)
  directory = getwd()
  table1 <- data.frame(matrix(1:9, nrow = 3))
  write.csv(table1, file = file.path(directory,"/table1.csv"))
  write.csv(table1, file = file.path(directory,"/table2.txt"))
  loadcsv_multi(directory, extension = "BOTH")

[Package easycsv version 1.0.8 Index]