arash1
February 19, 2022, 12:40pm
1
when I install ggplot2 I get the following error. It seems that it has installed, but it is not working when plotting.
install.packages("ggplot2")
Installing package into ‘C:/Users/IT FIX/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ggplot2_3.3.5.zip '
Content type 'application/zip' length 4130719 bytes (3.9 MB)
downloaded 3.9 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
It looks like it should be installed.
You are loading it using
library(ggplot2)
What happens if you run this code?
library(ggplot2)
dat1 <- data.frame(xx = 1:10, yy = 10:1)
ggplot(dat1, aes(xx, yy)) + geom_point()
arash1
February 19, 2022, 2:21pm
3
your code is working, but I do not know when it comes to my data it is not working.
Okay, at least we know the installation was successful.
To do more we need a reproducible example (reprex)
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.
Are you getting any error messages? If so be sure to include them.
arash1
February 22, 2022, 9:21am
5
Thank you for your help. It is working now.
system
Closed
March 15, 2022, 9:22am
6
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.