load_csv {qPRAentry} | R Documentation |
Load a CSV file with automatic separator detection
Description
Reads CSV files containing more than one column of data. It automatically detects common separators (i.e., comma, semicolon, tab), while allowing users to specify encoding and decimal separators as required.
Usage
load_csv(filepath, dec = ".", encoding = getOption("encoding"))
Arguments
filepath |
A string specifying the path to the CSV file (.csv extension). |
dec |
A character specifying the decimal separator to use. Default is "." (period). |
encoding |
A string specifying the encoding of the file. Default is the native
system encoding set by |
Value
A data frame containing the data from the CSV file.
Examples
# file path
fpath <- system.file("extdata", "data_ex.csv", package="qPRAentry")
# Load a CSV file
df <- load_csv(fpath)
head(df) # value as character
# Load a CSV file with comma separated decimals
df <- load_csv(fpath, dec = ",") # value as numeric
[Package qPRAentry version 0.1.1 Index]