[R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

Avi Gross @v|gro@@ @end|ng |rom ver|zon@net
Thu Aug 26 18:10:53 CEST 2021


Kai,

The answer is fairly probable to find  if you examine your variable "eth" as that is the only time you are being asked to provide the argument as in "ggplot(data=eth, ..) ...)

As the message states, it expects that argument to be a data frame or something it can change into a data.frame. What you gave it probably is an object meant to represent an EXCEL file or something. You may need to extract a data.frame (or tibble or ...) from it before passing that to ggplot.

Avi

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Kai Yang via R-help
Sent: Thursday, August 26, 2021 11:53 AM
To: R-help Mailing List <r-help using r-project.org>
Subject: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

Hello List,
I got an error message when I submit the code below ggplot(eth, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=ethnicity)) +  geom_rect() +  coord_polar(theta="y")  +  xlim(c(2, 4)   ) 

Error: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx


I checked the syntax. But I can  not find any error on my code. Can you help me to find where is the problem?

Thanks

	[[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list