combinecsv: Combine Several Comma Delimited Files into a Single Data...

Description Usage Arguments Details Value

View source: R/combinecsv.R

Description

Combine all csv files in a given directory into a single data frame.

Usage

1
combinecsv(myDir, addSource = TRUE, column1name = "Dummy_ID")

Arguments

myDir

A character scalar naming the directory in which the csv files are stored. Should end in a forward slash, e.g., "C:/temp/". All the csv files should have the same number of columns with the same header row of column names.

addSource

A logical scalar indicating whether a new column, named "source", should be added to the data frame identifying the source file, default TRUE.

column1name

A character scalar assigning a name to the first column in the data frame (writing over whatever name is there already), default "Dummy_ID".

Details

The column1name argument is needed to handle occasional problems with byte order marks at the beginning of the csv files, which can result in strange characters being added to the name of the first column. See, for example, this link.

Any variable names starting with "X." and ending with a number are changed to ensure the number part of the name is rounded to the nearest whole number, e.g., "X.76.000000" is renamed "X.76".

Value

A data frame with the information from all the csv files combined.


JVAdams/EchoNet2Fish documentation built on Feb. 15, 2021, 4:27 a.m.