read_csv: Read a csv file according to a schema specified in an xml...

View source: R/read_csv.R

read_csvR Documentation

Read a csv file according to a schema specified in an xml file.

Description

read_csv reads a csv file assigning column names and column types according to the specifications in an xml file.

Usage

read_csv(xmlFileName, csvFileName)

Arguments

xmlFileName

File name of the xml file containing the schema for the csv file.

csvFileName

File name of the csv file to validate.

Details

Return a data.table with the contents of the csv file.

Examples

rootPath <- file.path(system.file(package = "simutils"), "extdata")

# simulation file
csv_fn <- file.path(rootPath, "output_files", "antennas.csv")
xml_fn <- file.path(rootPath, "metadata/output_files", "antennas_dict.xml")
dt <- read_csv(xml_fn, csv_fn)
str(dt)

# coverage file
csv_fn <- file.path(rootPath, "output_files", "AntennaCells_MNO1.csv")
xml_fn <- file.path(rootPath, "metadata/output_files", "antennaCells_dict.xml")
dt <- read_csv(xml_fn, csv_fn)
str(dt)


bogdanoancea/simutils documentation built on April 4, 2022, 2:58 p.m.