Having issues plotting with ggplot2

Need help, i had to reinstall R studio, onto a new computer, and now receving errors when I try to plot

I added the following script:
ggplot(ff, aes(x = area)) + geom_histogram()

received this error:

ggplot(ff, aes(x = area)) + geom_histogram()
Error in ggplot(ff, aes(x = area)) : could not find function "ggplot"

Did you run

library("ggplot2")

?

Yes

library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in get(method, envir = home):
cannot open file 'C:/Users/lupes/Documents/R/win-library/3.6/lifecycle/R/lifecycle.rdb': No such file or directory
In addition: Warning messages:
1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4], :
restarting interrupted promise evaluation
2: In get(method, envir = home) :
restarting interrupted promise evaluation

You have a corrupted installation of lifecycle try installing it again

install.packages("lifecycle")

package ‘lifecycle’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\lupes\AppData\Local\Temp\RtmpmaQkTW\downloaded_packages

ff = read.delim('forestfires.tsv', header = TRUE, sep = '\t')
ggplot(ff, aes(x = area)) + geom_histogram()
Error in ggplot(ff, aes(x = area)) : could not find function "ggplot"

What happens now when you try to load ggplot2?

library("ggplot2")

library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in get(Info[i, 1], envir = env):
cannot open file 'C:/Users/lupes/Documents/R/win-library/3.6/colorspace/R/colorspace.rdb': No such file or directory

colorspace now.
repeat :slight_smile:

As @nirgrahamuk says, you are now missing a different package colorspace you have to keep solving this issues the same way until you can manage to load ggplot2 with out error messages

ggplot2(ff, aes(x = area)) + geom_histogram()
Error in ggplot2(ff, aes(x = area)) : could not find function "ggplot2"

As I said before, you are not going to be able to use ggplot until you manage to load it so instead of hopelessly running that code, try to load the package and see what is the next issue.

perhaps there is confusion due to the package being called ggplot2, but there is no such function.
i.e.

ggplot2::ggplot()

is probably what is meant ?

So for what i see i am to plug the following in my script:

ggplot2::ggplot()

Is that correct?

I don't have your script, nor your data. Therefore I can't say what ff is, nor area.
but assuming you had reason to believe that

ggplot2(ff, aes(x = area)) + geom_histogram()

would work, on that basis, I recommend attempting

ggplot(ff, aes(x = area)) + geom_histogram()

I do most of my plotting with the plotly package (who's main function is plot_ly() hilariously enough :slight_smile: )

ff is for 'Forestfires.csv' file that I am extracting my data and trying to plot.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.