Kai Yang
2021-Aug-26 15:53 UTC
[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]]
Thierry Onkelinx
2021-Aug-26 15:55 UTC
[R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"
eth is not a dataframe but of the class rxlsx. You'll need to convert eth into a dataframe. ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance thierry.onkelinx at inbo.be Havenlaan 88 bus 73, 1000 Brussel www.inbo.be /////////////////////////////////////////////////////////////////////////////////////////// To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey /////////////////////////////////////////////////////////////////////////////////////////// <https://www.inbo.be> Op do 26 aug. 2021 om 17:53 schreef Kai Yang via R-help < r-help at r-project.org>:> 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 at 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. >[[alternative HTML version deleted]]
Andrew Simmons
2021-Aug-26 15:56 UTC
[R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"
The class of 'eth' must be incorrect. You could try 'as.data.frame' or possibly 'as.list' to convert 'eth' to an acceptable form. On Thu, Aug 26, 2021, 11:53 Kai Yang via R-help <r-help at r-project.org> wrote:> 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 at 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. >[[alternative HTML version deleted]]
Avi Gross
2021-Aug-26 16:10 UTC
[R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"
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 at 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 at 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 at 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.