Trouble loading readr and dplyr

Hi,
I am trying to load these packages, I am getting an error as mentioned below. I have installed the packages using the menu from RStudio and using the code install.packages("readr")/("dplyr") but still I am facing the same problem. It could be helpful for me, if someone can suggest any ideas.

Thank you in advance.

load(readr)
Error in load(readr) : object 'readr' not found
load(dplyr)
Error in load(dplyr) : object 'dplyr' not found

You need to call library(readr), etc., rather than load.

4 Likes

Yeah I did that as well, but still I am facing the same error

Have you confirmed that you've installed readr and dplyr (e.g. do they show up in output of installed.packages())?

If not, you can install them with install.packages("readr") and install.packages("dplyr"), respectively.

If so, what is the output when you run library(readr) and library(dplyr)? In R, load() is a function for reloading datasets that have been written with save(), so the error should not be the same if you run library() and specify a package you haven't installed. I get different error messages if I run load(thingidonthave) and library(thingidonthave).

2 Likes

Yes, I have installed the packages, after running the library and load I get this error as mentioned below.
Input:
install.packages("readr")
install.packages("dplyr")

library(readr)
library(dplyr)

load(readr)
load(dplyr)

Output:

install.packages("readr")
package ‘readr’ successfully unpacked and MD5 sums checked
install.packages("dplyr")
package ‘dplyr’ successfully unpacked and MD5 sums checked

library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

load(readr)
Error in load(readr) : object 'readr' not found
load(dplyr)
Error in load(dplyr) : object 'dplyr' not found

You don't need to use load() to use a package; just library() (once the package is installed).

So if:

install.packages("dplyr")
library(dplyr)

Doesn't generate any errors, then you're ready to use dplyr!

4 Likes

Note also that those warnings are not errors. Minus the load() code, you're good to go.

1 Like

Okay. Thank you so much