7.9 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)


Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.