Data Science Desktop Survival Guide
by Graham Williams |
|||||
TSV Data |
20200928 A common interchange format for sharing data across different applications is the Tab Separated Value (tsv) file format. Reading tsv files is straight forward using readr::read_tsv().
library(readr) # Modern and efficient data reader/writer.
library(stringi) # String concat operator: %s+%. dsname <- "abc" dspath <- dsname %s+% ".tsv" abc <- read_csv(dspath) ds <- get(dsname)
Writing a dataset to a csv file is straightforward using readr::write_csv():
|
library(rattle) # Dataset: weatherAUS.
library(dplyr) # Wrangling: select(). library(readr) # Modern and efficient data reader/writer. dsname <- "weatherAUS" ds <- get(dsname) fname <- "australian_temperatures.tsv" ds %>% select(Date, Location, MinTemp, MaxTemp, Temp9am, Temp3pm) %>% write_tsv(fname)
|