loadData: Convenience function for loading data.

Description Usage Arguments Value See Also Examples

Description

The function recusively looks for the desired file in "./input". The name of data file should follow the following naming convention: prefix and a suffix seperated by an underscore. Use dashes to seperate terms in the prefix and suffix. For example, "train-stage1_tfidf-sublinear.csv".

Usage

1
2
loadData(prefix, suffix = NULL, file_ext = "csv", verbose = TRUE,
  data_path = "./input", reader = NULL, ...)

Arguments

prefix

Either the full name of the file to load (e.g., "train_features.csv" or the prefix of the file to load. If the full name is used then the suffix parameter should be NULL and the file extension should be included.

suffix

Suffix of the data file to load. This parameter could be useful when interating through features; e.g., in a for loop. (default is NULL)

file_ext

Determines the file extension of the file to load. loadData() calls the appropriate function to load the data. Accepted values are "csv", "rds", "rda", "xgb". If file_ext = "xgb" then the file to load is expected to be an xgb model. (default is "csv")

verbose

Whether or not to print details about the file being loaded. (default is TRUE)

reader

Function to read the data from disk. (default is NULL, the reader function is inferred from file_ext)

...

Additional parameters to pass the load function.

Value

The desired data to be loaded.

See Also

saveData The complimentary function to loadData. Data is saved with a naming convention compatible with loadData.

Examples

1
2
3
4
5
6
7
8
# load "./input/**/train_features.csv"
loadData("train_features")

# loads "./input/**/train_features.csv"
loadData("train", suffix="features")

# loads "./input/**/train_features.rds"
loadData("train", suffix="features", file_ext="rds")

mattmotoki/kaggleUtils documentation built on May 8, 2019, 11:57 p.m.