Error in read_tsv

combined <- read.csv("combined.csv")
genedmaster <- read_tsv("masterfile11_gened_final.txt")
d75master <- read_tsv("masterfile11_d75_final.txt")

I am getting the Following error in data Cleaning Project.

Error in read_tsv(“masterfile11_gened_final.txt”) :
could not find function “read_tsv”

I have installed and loaded all the Packages

install.packages("readr")
library(readr)
install.packages("dplyr")
library(dplyr)
install.packages("stringr")
library(stringr)
install.packages("purrr")
library(purrr)
install.packages("tidyverse")
library(tidyr)
install.packages("ggplot2")
library(ggplot2)

Please guide…

Hi @srivastava.anupam07, welcome to the community!

I have not made it this far in my path and I’m not familiar with read_tsv() or even what package it is in…but I did find that pandas.read_csv() is capable of opening tab separated value files since it has a delimiter argument.

My only “guess” on your problem as it is described above is that you have installed the packages but haven’t loaded them?

Best of luck and see you around!

read_tsv() is for tab separated values and it belongs to readr packages.

I have installed and loaded the package but getting the same error…

My apologies, I have no business offering advise here…I just realized this is for r, not python.

Maybe @otavios.s can help clarify…I saw he was replying to your post just as I was replying.

Sorry, I cannot. I don’t know much R. I thought there was a typo in the code, but apparently there isn’t.

Hi @srivastava.anupam07. Your code looks okay to me. I’d suggest running this line of code to ensure that the readr package is loaded: library(readr).

I was able to load the tsv file with the following code.

library(readr)
genedmaster <- read_tsv("masterfile11_gened_final.txt")
d75master <- read_tsv("masterfile11_d75_final.txt")

Also, ensure that the tsv file has been unzipped from the zip file.

Also, I’d recommend using the read_csv() function from the readr package for loading data into R, instead of the built-in read.csv() function.

If you’d like to read more on the subject, this Dataquest tutorial highlights the advantages of using read_csv() for loading data into R.

Best,
-Casey

1 Like