to more easily read data with a 2nd row with units common to phx data

read_phx(
  data,
  skip = 0,
  header = TRUE,
  sep = "auto",
  stringsAsFactors = FALSE,
  has_units = FALSE,
  fread = TRUE,
  data.table = FALSE,
  ...
)

Arguments

data

the name of the csv

skip

rows to skip before header row

header

logical value indicating whether the file contains the names of variables as it's first line

sep

field separator character. With fread defaults to 'auto', else defaults to ","

stringsAsFactors

logical value whether to include string columns as factors

has_units

logical value whether has a units row below the header (eg phx nlme data)

fread

logical value. Use fread from data.table for much faster reading

data.table

logical value. When using fread, whether to return data.table (TRUE) or data.frame (FALSE)

...

additional arguments to read.csv functions

Value

data frame of read-in csv

Details

helpful function to handle situations where the second row is a units row as often seen with phoenix-style datasets

Examples

if (FALSE) { read_phx("example.csv") read_phx("example.csv", skip = 1) # will ignore 1st line, good for comment lines }