Search code examples
rcsvreadr

Problem loading a tab-separated file using RStudio


Im trying to upload a dataset from .txt (tab separated file), but RStudio just do not recognize the contents.

Im wondering if it's about special encoding or something like that.

What I'm trying to upload:

enter image description here

What RSTUDIO shows:

enter image description here

library(readr)
X01172_BD03B_201902 <- read_delim("smp-22-09/01172_BD03B_201902.txt", 
    "\t", escape_double = FALSE, trim_ws = TRUE)
View(X01172_BD03B_201902)

We are using readr library.

An screenshot with console error desc:

enter image description here


Solution

  • Use read.csv():

    X01172_BD03B_201902 <- read.csv("smp-22-09/01172_BD03B_201902.txt", sep = "\t")