multicsv: Read/Write Multiple csv Files at a Time

Description Usage Arguments Details Value Note See Also Examples

Description

mcsv_w - Read and assign multiple csv files at the same time.

mcsv_w - Write multiple csv files into a file at the same time.

Usage

1
2
3
  mcsv_r(files, a.names = NULL, l.name = NULL, list = TRUE)

  mcsv_w(..., dir = NULL, open = FALSE)

Arguments

files

csv file(s) to read.

a.names

object names to assign the csv file(s) to. If NULL assigns the csv to the name(s) of the csv file(s) in the global environment.

l.name

A character vector of names to assign to the csv files (dataframes) being read in. Default (NULL) uses the names of the files in the directory without the file extension.

list

A character vector of length one to name the list being read in. Default is "L1".

...

data.frame object(s) to write to a file

dir

optional directory names. If NULL a directory will be created in the working directory with the data and time stamp as the folder name.

open

logical. If TURE opens the directory upon completion.

Details

mcsv is short for "multiple csv" and the suffix c(_r, _w) stands for "read" (r) or "write" (w).

Value

mcsv_r - reads in multiple csv files at once.

mcsv_w - creates a directory with multiple csv files. Silently returns the path of the directory.

Note

mcsv_r is useful for reading in multiple csv files from cm_csv.temp for interaction with cm_range2long.

See Also

cm_range2long, cm_df.temp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#mcsv_r EXAMPLE:
mtcarsb <- mtcars[1:5, ]; CO2b <- CO2[1:5, ]
(a <- mcsv_w(mtcarsb, CO2b, dir="foo"))
rm("mtcarsb", "CO2b")  # gone from .GlobalEnv
(nms <- dir(a))
mcsv_r(paste(a, nms, sep="/"))
mtcarsb; CO2b
rm("mtcarsb", "CO2b")  # gone from .GlobalEnv
mcsv_r(paste(a, nms, sep="/"), paste0("foo.dat", 1:2))
foo.dat1; foo.dat2
rm("foo.dat1", "foo.dat2")  # gone from .GlobalEnv
delete("foo")

#mcsv_w EXAMPLE:
(a <- mcsv_w(mtcars, CO2, dir="foo"))
delete("foo")

trinker/qdap2 documentation built on May 31, 2019, 9:47 p.m.