2
install.packages("readr")
setwd("~/Desktop/R_programing")
library(readr)

test <- read.delim(file='inpatient.tsv',header=TRUE, sep="\t")
test

colnames(test) [3:4] <- c("COL3","COL4")
write.delim(test, file = "result.tsv")
help.search("write.delim")

Here is my code, the function read.delim works fine however the line write.delim throws an error:

  could not find function "write.delim"

What could be wrong?

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
Ali Satari
  • 23
  • 3

1 Answers1

0

The readr package includes write_delim instead of write.delim

write_delim(test, file = "result.tsv")
akrun
  • 874,273
  • 37
  • 540
  • 662
  • 2
    ah ... so they were meaning to use readr functions – user20650 Sep 19 '21 at 20:35
  • 1
    You should have written this as a comment and voted to close. It's just a misspelling problem. – IRTFM Sep 20 '21 at 00:57
  • @IRTFM what about [this](https://stackoverflow.com/questions/69231356/how-to-subset-dataframe-based-on-values-that-do-not-match-in-two-columns-in-r/69231403#69231403) then? I see almost 100s of subset questions asked over the years – akrun Sep 20 '21 at 01:00