kishore
kishore

Reputation: 187

Errors while using readr, write_csv

Firstly,

I'm unable to use write_csv() function. I get the below error

Error in function_list[k] : could not find function "write_csv"

I've readr pacakge installed which gives the following warning:

Error in get(Info[i, 1], envir = env) : cannot open file 'C:/Users/kishore/Documents/R/win-library/3.3/rlang/R/rlang.rdb': No such file or directory In addition: Warning message: package ‘readr’ was built under R version 3.3.3 Error: package or namespace load failed for ‘readr’

Second,

when I'm trying to read a .csv or excel file I get the below error

c <- read_excel("C:/Users/kishore/Desktop/c.xlsx")

Error in get(Info[i, 1], envir = env) : cannot open file 'C:/Users/kishore/Documents/R/win-library/3.3/rlang/R/rlang.rdb': No such file or directory

View(c)

Error in View : object 'c' not found

I'm not sure what is the issue please advise

Upvotes: 1

Views: 5581

Answers (1)

Naveen
Naveen

Reputation: 1210

PS: I know that the issue has been resolved. I just want to point you to another solution.

If you have problems with readr package, try using the base functions like read.csv and write.csv from utils package. You dont have to install any new packages.

Example

#Reading a csv
#row.names tells that the 1st row contains the headers
df <- read.csv('/Users/Desktop/sample.csv', row.names=1)

#Writing into a csv
#row.names tells that the 1st row contains the column names
write.csv(df, '/Users/Desktop/sample_copy.csv', row.names=T)

Upvotes: 0

Related Questions