csv: Append a csv file and read it in R

Description Usage Arguments Details Value Examples

Description

append_csv() returns a function that can the be used to append a csv with a dataframe content. The returned function is write.table() with the following parameters : append = TRUE, col.names = FALSE, row.names = FALSE, sep = ",".

Usage

1
2
3

Arguments

file

the name of the file which the data are to be read from. Each row of the table appears as one line of the file. If it does not contain an absolute path, the file name is relative to the current working directory, getwd(). Tilde-expansion is performed where supported. This can be a compressed file (see file).

Alternatively, file can be a readable text-mode connection (which will be opened for reading if necessary, and if so closed (and hence destroyed) at the end of the function call). (If stdin() is used, the prompts for lines may be somewhat confusing. Terminate input with a blank line or an EOF signal, Ctrl-D on Unix and Ctrl-Z on Windows. Any pushback on stdin() will be cleared before return.)

file can also be a complete URL. (For the supported URL schemes, see the ‘URLs’ section of the help for url.)

print

Should the result be printed to the console?

Details

read_appended_csv() is a wrapper around read.csv(),. so please use that function for more control over the reading.

Value

append_csv() returns a function that can write a dataframe to a file. read_appended_csv() returns a data.frame with the content of the read csv.

Examples

1
2
3
4
5
6
7
8
if (interactive()){
    if (dockerstats_available()) {
        fls <- tempfile(fileext = ".csv")
        write_it <- append_csv(fls)
        write_it(dockerstats())
        read_appended_csv(fls)
    }
}

ColinFay/dockerstats documentation built on May 18, 2020, 11:54 a.m.