I am trying to plot data in ggplot (I tried a CRAN version from github too), but I end up getting an error:
Error in is.finite(x) : default method not implemented for type 'list'
This is the code for the plot:
ggplot(SinglePatient, aes(x = Condition, y = new, fill = Session)) +
stat_summary(fun.y = mean, geom = "bar", color = 'black', size = 1, position = "dodge") +
stat_summary(fun.data = mean_se, geom ="errorbar", width = .1, size = 1, position = position_dodge(width=.9))+
xlab("Condition") + ylab("Reaction time (ms)") +
scale_y_continuous(expand = c(0,0)) +
plot_theme
This is an example of data from the data.frame that I am using:
Patient Session Stimulus Trial Running[Trial] Block ACC Side Condition Group new.RT
7212 post blue_color.jpg 14 Center2ExpTrialList 2 incorrect L Center2Exp BrainHQ 251
7212 post brown_color.jpg 6 Center2ExpTrialList 2 correct R Center2Exp BrainHQ 253
7212 post blue_color.jpg 19 Center2ExpTrialList 2 correct L Center2Exp BrainHQ 256
7212 post brown_color.jpg 23 Center2ExpTrialList 12 correct R Center2Exp BrainHQ 261
7212 post blue_color.jpg 18 Center2ExpTrialList 2 correct L Center2Exp BrainHQ 267
Any idea of what I need to change? Thank you so much for your time.
me too…getting this error every time I try to use ggmosaic
I have the same issue. I am running R — 3.3.1 on a MAC and ggplot 2.2.19000
thanks everybody! That’s an issue with the dev version of ggplot2 — we are trying to fix it right now.
The CRAN version of ggplot2 doesn’t have that issue — if there’s a way you can use that you can work around the issue for right now until we’ve worked out the fix.
Thanks. I got it to work by installing the CRAN version of ggplot2 in the system folder, as opposed to my library and then set the lib.loc in the library function to the system folder.
i got the same error.. can anyone explain briefly how to use in CRAN version??????
The github version of ggmosaic (2.2.1.9000) is currently working with the development version of ggplot2, the CRAN version of either should also work with each other. Problems start when there is a mix.
@gsgayathri could you provide a session info (devtools::session_info())? Thanks!
@grawil @gsgayathri
I reinstall the ggplot2 with the command
devtools::install_github('cran/ggplot2')
and then the error disapears.
Any update on the above?
Thanks @wzrzt for the suggestion. It did the trick.
Best,
I did the test today and the issue is still here (working with the CRAN version but not the github one).
@antuki I found the problem too, after R updated to 3.4.1, and ggplot2 updated to the newest.
It’s always dangerous to update…
I was having the same error and I was working with mongodb, ggplot and Rshiny. As workaround I converted all NULL value in dataframe as NA
#mongodb aggregation
out <- dbAggregate(con, «Documenti», list)
#conversion from JSON to nested lists
out2 <- lapply(out, fromJSON, simplifyDataFrame = TRUE)
#conversion to dataframe
dd <- do.call(rbind,out2)
#Conversion null value to NA
dd[sapply(dd, is.null)] <- NA
I just upgraded to ggplot2 3.0.0 and example(ggmosaic)
doesn’t run This is what I get with R 3.5.1:
> example(geom_mosaic)
gm_msc> data(Titanic)
gm_msc> titanic <- as.data.frame(Titanic)
gm_msc> titanic$Survived <- factor(titanic$Survived, levels=c("Yes", "No"))
gm_msc> ggplot(data=titanic) +
gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), fill=Survived))
Hit <Return> to see next plot:
Error in is.finite(x) : default method not implemented for type 'list'
EDIT: I just verified on a second machine that the example runs fine before upgrading ggplot2, and fails afterwards.
@wzrzt’s method worked for me; reinstall ggplot2
from github:
devtools::install_github('cran/ggplot2')
Could you please be sure you’ve installed ggplot2 3.0.0 before running
`example(geom_mosiac)` code? This is the version now (as of last week) on
CRAN and also on github (I just installed it from there). I get the same
error either way. perhaps you could post your results along with the
results of `packageVersion(‘ggplot2’)`? After installing from github I get
«3.0.0». Thanks.
…
I am seeing the same error. Here is what I am running:
> packageVersion("ggplot2")
[1] ‘3.0.0’
> packageVersion("ggmosaic")
[1] ‘0.1.2’
> R.version.string
[1] "R version 3.5.0 (2018-04-23)"
This is on macOS High Sierra 10.13.5
I will update to R 3.5.1 to see if that helps.
Although I was running ggplot2
version 3.0.0, I could only resolve this problem by fetching it from GitHub. Note that that got me version 2.2.1 of ggplot2
, which does work.
My guess is that ggplot developers have attempted to revert their broken update, but only those fetching from the git repository are seeing that they have gone back to 2.2.1. But that is only a guess.
@jpgoldberg: try `remove.packages(‘ggplot2’)` then
`devtools::install_github(‘hadley/ggplot2’)`. I get 3.0.0 and that’s the
version in master on github.
…
On Sun, Jul 8, 2018 at 4:32 PM Jeffrey Goldberg ***@***.***> wrote:
Although I was running ggplot2 version 3.0.0, I could only resolve this
problem by fetching it from GitHub. Note that that got me version 2.2.1 of
ggplot2, which does work.
My guess is that ggplot developers have attempted to revert their broken
update, but only those fetching from the git repository are seeing that
they have gone back to 2.2.1. But that is only a guess.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#9 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIJj1duREDdnofjnYgXeFOTp-RNiUyJFks5uEnqAgaJpZM4M2bEe>
.
This works with the current development version of ggmosaic:
library(tidyverse) library(ggmosaic) #> Loading required package: productplots #> #> Attaching package: 'ggmosaic' #> The following objects are masked from 'package:productplots': #> #> ddecker, hspine, mosaic, prodcalc, spine, vspine example("geom_mosaic") #> #> gm_msc> data(Titanic) #> #> gm_msc> titanic <- as.data.frame(Titanic) #> #> gm_msc> titanic$Survived <- factor(titanic$Survived, levels=c("Yes", "No")) #> #> gm_msc> ggplot(data=titanic) + #> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), fill=Survived))
#>
#> gm_msc> # good practice: use the 'dependent' variable (or most important variable)
#> gm_msc> # as fill variable
#> gm_msc>
#> gm_msc> # or turn the dependent variable on explicitly (note the difference in the
#> gm_msc> # labelling of the y axis)
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), y=product(Survived),
#> gm_msc+ fill=Survived))
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class, Age), fill=Survived))
#>
#> gm_msc> # we can change where we define variables
#> gm_msc> ggplot(data=titanic, aes(weight = Freq, fill=Survived, x=product(Class, Age))) +
#> gm_msc+ geom_mosaic()
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), conds=product(Age), fill=Survived))
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Survived, Class), fill=Age))
#>
#> gm_msc> ## Not run:
#> gm_msc> ##D data(happy, package="productplots")
#> gm_msc> ##D
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(x=product(happy)), divider="hbar")
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(x=product(happy))) +
#> gm_msc> ##D coord_flip()
#> gm_msc> ##D # weighting is important
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(happy)))
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(weight=wtssall, x=product(health), fill=happy)) +
#> gm_msc> ##D theme(axis.text.x=element_text(angle=35))
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(health), fill=happy), na.rm=TRUE)
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(health, sex, degree), fill=happy),
#> gm_msc> ##D na.rm=TRUE)
#> gm_msc> ##D
#> gm_msc> ##D # here is where a bit more control over the spacing of the bars is helpful:
#> gm_msc> ##D # set labels manually:
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset=0) +
#> gm_msc> ##D scale_x_productlist("Age", labels=c(17+1:72))
#> gm_msc> ##D # thin out labels manually:
#> gm_msc> ##D labels <- c(17+1:72)
#> gm_msc> ##D labels[labels %% 5 != 0] <- ""
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset=0) +
#> gm_msc> ##D scale_x_productlist("Age", labels=labels)
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy, conds = sex),
#> gm_msc> ##D divider=mosaic("v"), na.rm=TRUE, offset=0.001) +
#> gm_msc> ##D scale_x_productlist("Age", labels=labels)
#> gm_msc> ##D # facetting works!!!!
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset = 0) +
#> gm_msc> ##D facet_grid(sex~.) +
#> gm_msc> ##D scale_x_productlist("Age", labels=labels)
#> gm_msc> ##D
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(happy, finrela, health)),
#> gm_msc> ##D divider=mosaic("h"))
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(happy, finrela, health)), offset=.005)
#> gm_msc> ##D
#> gm_msc> ##D # Spine example
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(health), fill = health)) +
#> gm_msc> ##D facet_grid(happy~.)
#> gm_msc> ## End(Not run)
#> gm_msc>
#> gm_msc>
#> gm_msc>
Created on 2018-07-09 by the reprex package (v0.2.0).
This works with the current development version of ggmosaic:
library(tidyverse)
library(ggmosaic)
Yes. And that is because tidyverse loads ggplot2 2.2.1 and not ggplot2 3.0.0.
> library(tidyverse)
── Attaching packages ────────────────────────────────── tidyverse 1.2.1 ──
✔ ggplot2 2.2.1 ✔ purrr 0.2.5
✔ tibble 1.4.2 ✔ dplyr 0.7.6
✔ tidyr 0.8.1 ✔ stringr 1.3.1
✔ readr 1.1.1 ✔ forcats 0.3.0
Yes. And that is because tidyverse loads ggplot2 2.2.1 and not ggplot2 3.0.0.
Actually, because I’m running dev versions, it was/is ggplot2 3.0.0, but here it is with ggplot2 attached alone.
See below:
library(ggplot2) library(ggmosaic) #> Loading required package: tibble #> Loading required package: productplots #> #> Attaching package: 'ggmosaic' #> The following objects are masked from 'package:productplots': #> #> ddecker, hspine, mosaic, prodcalc, spine, vspine example("geom_mosaic") #> #> gm_msc> data(Titanic) #> #> gm_msc> titanic <- as.data.frame(Titanic) #> #> gm_msc> titanic$Survived <- factor(titanic$Survived, levels=c("Yes", "No")) #> #> gm_msc> ggplot(data=titanic) + #> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), fill=Survived))
#>
#> gm_msc> # good practice: use the 'dependent' variable (or most important variable)
#> gm_msc> # as fill variable
#> gm_msc>
#> gm_msc> # or turn the dependent variable on explicitly (note the difference in the
#> gm_msc> # labelling of the y axis)
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), y=product(Survived),
#> gm_msc+ fill=Survived))
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class, Age), fill=Survived))
#>
#> gm_msc> # we can change where we define variables
#> gm_msc> ggplot(data=titanic, aes(weight = Freq, fill=Survived, x=product(Class, Age))) +
#> gm_msc+ geom_mosaic()
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), conds=product(Age), fill=Survived))
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Survived, Class), fill=Age))
#>
#> gm_msc> ## Not run:
#> gm_msc> ##D data(happy, package="productplots")
#> gm_msc> ##D
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(x=product(happy)), divider="hbar")
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(x=product(happy))) +
#> gm_msc> ##D coord_flip()
#> gm_msc> ##D # weighting is important
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(happy)))
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(weight=wtssall, x=product(health), fill=happy)) +
#> gm_msc> ##D theme(axis.text.x=element_text(angle=35))
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(health), fill=happy), na.rm=TRUE)
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(health, sex, degree), fill=happy),
#> gm_msc> ##D na.rm=TRUE)
#> gm_msc> ##D
#> gm_msc> ##D # here is where a bit more control over the spacing of the bars is helpful:
#> gm_msc> ##D # set labels manually:
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset=0) +
#> gm_msc> ##D scale_x_productlist("Age", labels=c(17+1:72))
#> gm_msc> ##D # thin out labels manually:
#> gm_msc> ##D labels <- c(17+1:72)
#> gm_msc> ##D labels[labels %% 5 != 0] <- ""
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset=0) +
#> gm_msc> ##D scale_x_productlist("Age", labels=labels)
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy, conds = sex),
#> gm_msc> ##D divider=mosaic("v"), na.rm=TRUE, offset=0.001) +
#> gm_msc> ##D scale_x_productlist("Age", labels=labels)
#> gm_msc> ##D # facetting works!!!!
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset = 0) +
#> gm_msc> ##D facet_grid(sex~.) +
#> gm_msc> ##D scale_x_productlist("Age", labels=labels)
#> gm_msc> ##D
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(happy, finrela, health)),
#> gm_msc> ##D divider=mosaic("h"))
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(happy, finrela, health)), offset=.005)
#> gm_msc> ##D
#> gm_msc> ##D # Spine example
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(health), fill = health)) +
#> gm_msc> ##D facet_grid(happy~.)
#> gm_msc> ## End(Not run)
#> gm_msc>
#> gm_msc>
#> gm_msc>
devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.4 (2018-03-15)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> tz America/New_York
#> date 2018-07-09
#> Packages -----------------------------------------------------------------
#> package * version date
#> assertthat 0.2.0.9000 2018-06-27
#> backports 1.1.3 2018-05-15
#> base * 3.4.4 2018-03-15
#> bindr 0.1.1 2018-03-13
#> bindrcpp 0.2.2.9000 2018-04-03
#> colorspace 1.3-2 2016-12-14
#> compiler 3.4.4 2018-03-15
#> crayon 1.3.4 2018-05-25
#> data.table 1.11.4 2018-05-27
#> datasets * 3.4.4 2018-03-15
#> devtools 1.13.6 2018-06-27
#> digest 0.6.15 2018-01-28
#> dplyr 0.7.6 2018-06-29
#> evaluate 0.10.1 2017-06-24
#> ggmosaic * 0.1.2.9000 2018-07-09
#> ggplot2 * 3.0.0 2018-07-03
#> glue 1.2.0.9000 2018-06-20
#> graphics * 3.4.4 2018-03-15
#> grDevices * 3.4.4 2018-03-15
#> grid 3.4.4 2018-03-15
#> gtable 0.2.0 2016-02-26
#> htmltools 0.3.6.9001 2018-06-20
#> htmlwidgets 1.2.1 2018-06-22
#> httr 1.3.1 2017-08-20
#> jsonlite 1.5 2017-06-01
#> knitr 1.20 2018-02-20
#> labeling 0.3 2014-08-23
#> lazyeval 0.2.1.9000 2018-03-20
#> magrittr 1.5 2014-11-22
#> memoise 1.1.0 2018-03-20
#> methods * 3.4.4 2018-03-15
#> munsell 0.5.0 2018-06-12
#> pillar 1.2.4 2018-07-09
#> pkgconfig 2.0.1 2017-03-21
#> plotly 4.7.1.9000 2018-07-09
#> plyr 1.8.4 2016-06-08
#> productplots * 0.1.1 2016-07-02
#> purrr 0.2.5 2018-05-29
#> R6 2.2.2 2017-06-17
#> Rcpp 0.12.17 2018-05-18
#> rlang 0.2.0.9001 2018-07-08
#> rmarkdown 1.10 2018-06-11
#> rprojroot 1.3-2 2018-01-03
#> scales 0.5.0.9000 2018-07-09
#> stats * 3.4.4 2018-03-15
#> stringi 1.2.3 2018-06-12
#> stringr 1.3.1 2018-05-10
#> tibble * 1.4.2.9003 2018-07-09
#> tidyr 0.8.1 2018-05-18
#> tidyselect 0.2.4.9000 2018-05-29
#> tools 3.4.4 2018-03-15
#> utils * 3.4.4 2018-03-15
#> viridisLite 0.3.0 2018-02-01
#> withr 2.1.2 2018-06-27
#> yaml 2.1.19 2018-05-01
#> source
#> Github (hadley/assertthat@ec90526)
#> Github (r-lib/backports@76f9e66)
#> local
#> CRAN (R 3.4.3)
#> Github (krlmlr/bindrcpp@bd5ae73)
#> cran (@1.3-2)
#> local
#> Github (gaborcsardi/crayon@3e751fb)
#> CRAN (R 3.4.4)
#> local
#> CRAN (R 3.4.4)
#> cran (@0.6.15)
#> CRAN (R 3.4.4)
#> CRAN (R 3.4.0)
#> Github (haleyjeppson/ggmosaic@9c88d62)
#> CRAN (R 3.4.4)
#> Github (tidyverse/glue@a2c0f8b)
#> local
#> local
#> local
#> cran (@0.2.0)
#> Github (rstudio/htmltools@3aee819)
#> Github (ramnathv/htmlwidgets@29ca4f7)
#> CRAN (R 3.4.1)
#> CRAN (R 3.4.0)
#> CRAN (R 3.4.3)
#> cran (@0.3)
#> Github (hadley/lazyeval@93c455c)
#> cran (@1.5)
#> Github (hadley/memoise@06d16ec)
#> local
#> CRAN (R 3.4.3)
#> Github (r-lib/pillar@dfc3d41)
#> cran (@2.0.1)
#> Github (ropensci/plotly@a76100d)
#> cran (@1.8.4)
#> CRAN (R 3.4.0)
#> CRAN (R 3.4.3)
#> CRAN (R 3.4.0)
#> CRAN (R 3.4.3)
#> Github (r-lib/rlang@b4f810f)
#> CRAN (R 3.4.3)
#> CRAN (R 3.4.2)
#> Github (hadley/scales@a0f0da1)
#> local
#> CRAN (R 3.4.3)
#> cran (@1.3.1)
#> Github (tidyverse/tibble@22a357e)
#> CRAN (R 3.4.3)
#> Github (tidyverse/tidyselect@0ea6d54)
#> local
#> local
#> cran (@0.3.0)
#> Github (r-lib/withr@fe56f20)
#> CRAN (R 3.4.3)
Created on 2018-07-09 by the reprex package (v0.2.0).
The new version of ggmosaic fixes the problem for me. Thanks!
…
On Mon, Jul 9, 2018 at 4:31 PM Mara Averick ***@***.***> wrote:
Yes. And that is because tidyverse loads ggplot2 2.2.1 and not ggplot2
3.0.0.
See below:
library(ggplot2)
library(ggmosaic)#> Loading required package: tibble#> Loading required package: productplots#> #> Attaching package: ‘ggmosaic’#> The following objects are masked from ‘package:productplots’:#> #> ddecker, hspine, mosaic, prodcalc, spine, vspine
example(«geom_mosaic»)#> #> gm_msc> data(Titanic)#> #> gm_msc> titanic <- as.data.frame(Titanic)#> #> gm_msc> titanic$Survived <- factor(titanic$Survived, levels=c(«Yes», «No»))#> #> gm_msc> ggplot(data=titanic) +#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), fill=Survived))
<https://camo.githubusercontent.com/ac34be0919048c3d85baf3eec3aad0001d6d64f6/68747470733a2f2f692e696d6775722e636f6d2f4d3458383367512e706e67>
#>
#> gm_msc> # good practice: use the ‘dependent’ variable (or most important variable)
#> gm_msc> # as fill variable
#> gm_msc>
#> gm_msc> # or turn the dependent variable on explicitly (note the difference in the
#> gm_msc> # labelling of the y axis)
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), y=product(Survived),
#> gm_msc+ fill=Survived))
<https://camo.githubusercontent.com/3b5ef4f172eb332d4465872c3cc2611e0ab1d912/68747470733a2f2f692e696d6775722e636f6d2f315367707647672e706e67>
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class, Age), fill=Survived))
<https://camo.githubusercontent.com/ed81559f49dc21eaf64b33ba1491d2e341c0f6a3/68747470733a2f2f692e696d6775722e636f6d2f37594f38644a692e706e67>
#>
#> gm_msc> # we can change where we define variables
#> gm_msc> ggplot(data=titanic, aes(weight = Freq, fill=Survived, x=product(Class, Age))) +
#> gm_msc+ geom_mosaic()
<https://camo.githubusercontent.com/a8fe501607e9b32918253c5e6824087c6f90cced/68747470733a2f2f692e696d6775722e636f6d2f6551374a446d712e706e67>
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Class), conds=product(Age), fill=Survived))
<https://camo.githubusercontent.com/12ffaf34fd59e6a000cfb20d5eb5b1068b54c1ed/68747470733a2f2f692e696d6775722e636f6d2f35754f546857582e706e67>
#>
#> gm_msc> ggplot(data=titanic) +
#> gm_msc+ geom_mosaic(aes(weight=Freq, x=product(Survived, Class), fill=Age))
<https://camo.githubusercontent.com/ecfa2f9caa22fb02a46345d6e282bc814ee1c385/68747470733a2f2f692e696d6775722e636f6d2f4e794d477154702e706e67>
#>
#> gm_msc> ## Not run:
#> gm_msc> ##D data(happy, package=»productplots»)
#> gm_msc> ##D
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(x=product(happy)), divider=»hbar»)
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(x=product(happy))) +
#> gm_msc> ##D coord_flip()
#> gm_msc> ##D # weighting is important
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(happy)))
#> gm_msc> ##D ggplot(data = happy) + geom_mosaic(aes(weight=wtssall, x=product(health), fill=happy)) +
#> gm_msc> ##D theme(axis.text.x=element_text(angle=35))
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(health), fill=happy), na.rm=TRUE)
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(health, sex, degree), fill=happy),
#> gm_msc> ##D na.rm=TRUE)
#> gm_msc> ##D
#> gm_msc> ##D # here is where a bit more control over the spacing of the bars is helpful:
#> gm_msc> ##D # set labels manually:
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset=0) +
#> gm_msc> ##D scale_x_productlist(«Age», labels=c(17+1:72))
#> gm_msc> ##D # thin out labels manually:
#> gm_msc> ##D labels <- c(17+1:72)
#> gm_msc> ##D labels[labels %% 5 != 0] <- «»
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset=0) +
#> gm_msc> ##D scale_x_productlist(«Age», labels=labels)
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy, conds = sex),
#> gm_msc> ##D divider=mosaic(«v»), na.rm=TRUE, offset=0.001) +
#> gm_msc> ##D scale_x_productlist(«Age», labels=labels)
#> gm_msc> ##D # facetting works!!!!
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight=wtssall, x=product(age), fill=happy), na.rm=TRUE, offset = 0) +
#> gm_msc> ##D facet_grid(sex~.) +
#> gm_msc> ##D scale_x_productlist(«Age», labels=labels)
#> gm_msc> ##D
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(happy, finrela, health)),
#> gm_msc> ##D divider=mosaic(«h»))
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(happy, finrela, health)), offset=.005)
#> gm_msc> ##D
#> gm_msc> ##D # Spine example
#> gm_msc> ##D ggplot(data = happy) +
#> gm_msc> ##D geom_mosaic(aes(weight = wtssall, x = product(health), fill = health)) +
#> gm_msc> ##D facet_grid(happy~.)
#> gm_msc> ## End(Not run)
#> gm_msc>
#> gm_msc>
#> gm_msc>
devtools::session_info()
#> Session info ————————————————————-
#> setting value
#> version R version 3.4.4 (2018-03-15)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> tz America/New_York
#> date 2018-07-09
#> Packages ——————————————————————
#> package * version date
#> assertthat 0.2.0.9000 2018-06-27
#> backports 1.1.3 2018-05-15
#> base * 3.4.4 2018-03-15
#> bindr 0.1.1 2018-03-13
#> bindrcpp 0.2.2.9000 2018-04-03
#> colorspace 1.3-2 2016-12-14
#> compiler 3.4.4 2018-03-15
#> crayon 1.3.4 2018-05-25
#> data.table 1.11.4 2018-05-27
#> datasets * 3.4.4 2018-03-15
#> devtools 1.13.6 2018-06-27
#> digest 0.6.15 2018-01-28
#> dplyr 0.7.6 2018-06-29
#> evaluate 0.10.1 2017-06-24
#> ggmosaic * 0.1.2.9000 2018-07-09
#> ggplot2 * 3.0.0 2018-07-03
#> glue 1.2.0.9000 2018-06-20
#> graphics * 3.4.4 2018-03-15
#> grDevices * 3.4.4 2018-03-15
#> grid 3.4.4 2018-03-15
#> gtable 0.2.0 2016-02-26
#> htmltools 0.3.6.9001 2018-06-20
#> htmlwidgets 1.2.1 2018-06-22
#> httr 1.3.1 2017-08-20
#> jsonlite 1.5 2017-06-01
#> knitr 1.20 2018-02-20
#> labeling 0.3 2014-08-23
#> lazyeval 0.2.1.9000 2018-03-20
#> magrittr 1.5 2014-11-22
#> memoise 1.1.0 2018-03-20
#> methods * 3.4.4 2018-03-15
#> munsell 0.5.0 2018-06-12
#> pillar 1.2.4 2018-07-09
#> pkgconfig 2.0.1 2017-03-21
#> plotly 4.7.1.9000 2018-07-09
#> plyr 1.8.4 2016-06-08
#> productplots * 0.1.1 2016-07-02
#> purrr 0.2.5 2018-05-29
#> R6 2.2.2 2017-06-17
#> Rcpp 0.12.17 2018-05-18
#> rlang 0.2.0.9001 2018-07-08
#> rmarkdown 1.10 2018-06-11
#> rprojroot 1.3-2 2018-01-03
#> scales 0.5.0.9000 2018-07-09
#> stats * 3.4.4 2018-03-15
#> stringi 1.2.3 2018-06-12
#> stringr 1.3.1 2018-05-10
#> tibble * 1.4.2.9003 2018-07-09
#> tidyr 0.8.1 2018-05-18
#> tidyselect 0.2.4.9000 2018-05-29
#> tools 3.4.4 2018-03-15
#> utils * 3.4.4 2018-03-15
#> viridisLite 0.3.0 2018-02-01
#> withr 2.1.2 2018-06-27
#> yaml 2.1.19 2018-05-01
#> source
#> Github ***@***.***)
#> Github ***@***.***)
#> local
#> CRAN (R 3.4.3)
#> Github ***@***.***)
#> cran ***@***.***)
#> local
#> Github ***@***.***)
#> CRAN (R 3.4.4)
#> local
#> CRAN (R 3.4.4)
#> cran ***@***.***)
#> CRAN (R 3.4.4)
#> CRAN (R 3.4.0)
#> Github ***@***.***)
#> CRAN (R 3.4.4)
#> Github ***@***.***)
#> local
#> local
#> local
#> cran ***@***.***)
#> Github ***@***.***)
#> Github ***@***.***)
#> CRAN (R 3.4.1)
#> CRAN (R 3.4.0)
#> CRAN (R 3.4.3)
#> cran ***@***.***)
#> Github ***@***.***)
#> cran ***@***.***)
#> Github ***@***.***)
#> local
#> CRAN (R 3.4.3)
#> Github ***@***.***)
#> cran ***@***.***)
#> Github ***@***.***)
#> cran ***@***.***)
#> CRAN (R 3.4.0)
#> CRAN (R 3.4.3)
#> CRAN (R 3.4.0)
#> CRAN (R 3.4.3)
#> Github ***@***.***)
#> CRAN (R 3.4.3)
#> CRAN (R 3.4.2)
#> Github ***@***.***)
#> local
#> CRAN (R 3.4.3)
#> cran ***@***.***)
#> Github ***@***.***)
#> CRAN (R 3.4.3)
#> Github ***@***.***)
#> local
#> local
#> cran ***@***.***)
#> Github ***@***.***)
#> CRAN (R 3.4.3)
Created on 2018-07-09 by the reprex package <http://reprex.tidyverse.org>
(v0.2.0).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIJj1fX4RJFIv_SzkxFsPrkKqLP6LBJJks5uE8vDgaJpZM4M2bEe>
.
Have the same error now in 2019. ggplot2 and ggmosaic are up-to-date. I am trying to use eigen.analysis() on a matrix. The matrix was originally converted from a list using matrix(list, ncol=5)
Please post a reproducible example, so we can trouble shoot.
…
On Mon, Apr 8, 2019 at 3:02 PM Huong Nguyen @.***> wrote: Have the same error now in 2019. ggplot2 and ggmosaic are up-to-date. I am trying to use eigen.analysis() on a matrix. The matrix was originally converted from a list using matrix(list, ncol=5) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#9 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFq0tEI7PE_z1zHTxu6s82bxidWdQjdks5ve6A2gaJpZM4M2bEe .
Thank you for your speedy response. Updating R solved my problem.
Still having this problem. Just updated to R 3.6, tried ggplot2 3.1.0 and 3.2.0
sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Roundinglocale:
[1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252
[4] LC_NUMERIC=C LC_TIME=Spanish_Spain.1252attached base packages:
[1] stats graphics grDevices utils datasets methods baseother attached packages:
[1] lubridate_1.7.4 rgdal_1.4-4 sp_1.3-1 forcats_0.4.0 stringr_1.4.0 dplyr_0.8.1
[7] purrr_0.3.2 readr_1.3.1 tidyr_0.8.3 tibble_2.1.3 ggplot2_3.1.0 tidyverse_1.2.1
[13] plyr_1.8.4loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 cellranger_1.1.0 pillar_1.4.1 compiler_3.6.0 tools_3.6.0
[6] jsonlite_1.6 gtable_0.3.0 nlme_3.1-139 lattice_0.20-38 pkgconfig_2.0.2
[11] rlang_0.3.4 cli_1.1.0 rstudioapi_0.10 yaml_2.2.0 haven_2.1.0
[16] raster_2.9-5 withr_2.1.2 xml2_1.2.0 httr_1.4.0 rgeos_0.4-3
[21] generics_0.0.2 hms_0.4.2 grid_3.6.0 tidyselect_0.2.5 glue_1.3.1
[26] R6_2.4.0 readxl_1.3.1 foreign_0.8-71 modelr_0.1.4 magrittr_1.5
[31] maptools_0.9-5 codetools_0.2-16 backports_1.1.4 scales_1.0.0 rvest_0.3.4
[36] assertthat_0.2.1 colorspace_1.4-1 stringi_1.4.3 lazyeval_0.2.2 munsell_0.5.0
[41] broom_0.5.2 crayon_1.3.4
Still having the same problem.
R: 3.6.2
ggplot2: 3.2.1
Same issue R version 4.1.1
Tried unlist() and downloading directly from CRAN
library(ggplot2)
dev.new()
set.seed(1684)
x = seq(15, 33, by = 0.9)
f <- function(x) {
out <- ifelse(
x < 15 | 33 < x,
0,
ifelse(
15 <= x & x <= 24,
(2*(x-15))/((33-15)*(24-15)),
ifelse(
24 < x & x <= 33,
(2*(33-x))/((33-15)*(33-24)),
NA_real_
)))
if (any((is.na(out) | is.nan(out)) & (!is.na(x) & !is.nan(x)))) {
warning("f(x) undefined for some input values")
}
out
}
x_accept <- numeric(0)
while (length(x_accept) != 105) {
x1 = runif(1, min = 15, max = 33)
num = runif(1, min = 0, max = 1)
if (num < (f(x1)/2/(33-15))) {
x_accept = c(x_accept, x1)
}
}
histo <- data.frame(x = x_accept)
dat <- data.frame(x = x, y = f(x), z = histo)
ggplot(dat) +
geom_line(aes(x, y), color = "red") +
geom_histogram(aes(histo), alpha = .5, binwidth = 1)
When I use this code it gives me the error, I think it assumes that ‘histo’ is a list, but it’s a dataframe, so I don’t really know what’s wrong.
>Solution :
use data=histo
and set x=x
and y to density (y=..density..
)
ggplot(dat) +
geom_line(aes(x, y), color = "red") +
geom_histogram(aes(x,..density..),data=histo, alpha = .5, binwidth = 1)
or using only one dataframe:
dat <- data.frame(x = x, y = f(x), z = x_accept) #z=x_accept instead of histo
ggplot(dat) +
geom_line(aes(x, y), color = "red") +
geom_histogram(aes(z,..density..), alpha = .5, binwidth = 1)
I was working on my Apply Bayesian assignment today and run into the following error message,
“Error in is.finite(x) : default method not implemented for type ‘list’
In addition: Warning message:
In FUN(X[[i]], …) : class of ‘x’ was discarded”.
I double checked all my codes and found no errors (I could detect). As usual, when I get stuck, I go ask Dr. Google. Two posts on inside-r encountered the same error message as the one I had. Unfortunately, these two posts were ask for help type of posts and no one had replied. However, one person did mention he/she suspected there might be some data formatting inconsistency of the submitted R codes (R codes to OpenBugs).
This is really helpful! I went back to my original data and realized I loaded my data as data frame not a matrix. If you force your data to be a matrix format then all values in your data will be numerical. On top of that, matrix format has two dimensions, the rows and columns and is a must if you are, in your OpenBugs model, calculating results in a linear algebra fashion. I changed my data format to matrix and successfully debugged my codes. Yeah!
Here is the doc of my R codes for the model, you can see I was calling for matrix summation in my openbugs model.Codes
Here is the break down of attributes of the two data formats. > mydata2 = read.table("C:/Users/Kuan Liu/Desktop/Course/Apply Bayesian/hw3/BigRatDat.txt") > mydata = as.matrix(read.table("C:/Users/Kuan Liu/Desktop/Course/Apply Bayesian/hw3/BigRatDat.txt")) > attributes(mydata) $dim [1] 50 13 $dimnames $dimnames[[1]] NULL $dimnames[[2]] [1] "V1" "V2" "V3" "V4" "V5" "V6" "V7" "V8" "V9" "V10" "V11" "V12" "V13" > attributes(mydata2) $names [1] "V1" "V2" "V3" "V4" "V5" "V6" "V7" "V8" "V9" "V10" "V11" "V12" "V13" $class [1] "data.frame" $row.names [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 [47] 47 48 49 50
I am trying to plot data in ggplot (I tried a CRAN version from github too), but I end up getting an error:
Error in is.finite(x) : default method not implemented for type 'list'
This is the code for the plot:
ggplot(SinglePatient, aes(x = Condition, y = new, fill = Session)) + stat_summary(fun.y = mean, geom = "bar", color = 'black', size = 1, position = "dodge") + stat_summary(fun.data = mean_se, geom ="errorbar", width = .1, size = 1, position = position_dodge(width=.9))+ xlab("Condition") + ylab("Reaction time (ms)") + scale_y_continuous(expand = c(0,0)) + plot_theme
This is an example of data from the data.frame that I am using:
Patient Session Stimulus Trial Running[Trial] Block ACC Side Condition Group new.RT 7212 post blue_color.jpg 14 Center2ExpTrialList 2 incorrect L Center2Exp BrainHQ 251 7212 post brown_color.jpg 6 Center2ExpTrialList 2 correct R Center2Exp BrainHQ 253 7212 post blue_color.jpg 19 Center2ExpTrialList 2 correct L Center2Exp BrainHQ 256 7212 post brown_color.jpg 23 Center2ExpTrialList 12 correct R Center2Exp BrainHQ 261 7212 post blue_color.jpg 18 Center2ExpTrialList 2 correct L Center2Exp BrainHQ 267
Any idea of what I need to change? Thank you so much for your time.
I am returning the error «is.finite(x):default method not implemented for type «list»»
I am trying to plot these co-ordinates onto each quadrant to assess the usefulness of each action. I would also like to add a legend with the name of each event as a colour. Here is my code:
Df<-structure(list(ï..Idea = structure(c(2L, 1L, 6L, 5L, 4L, 3L), .Label = c("Find motivation online",
"Reward yourself for tidying room", "Schedule: communication",
"Schedule: Diary", "Schedule: phone", "Start as soon as you see mess"
), class = "factor"), Effort = c(2L, 2L, 4L, 1L, 3L, 4L), Impact = c(7L,
4L, 9L, 6L, 5L, 6L), Topic = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = "Project Tidy Room", class = "factor")), class = "data.frame", row.names = c(NA,
-6L))
install.package("ggplot2")
install.package("dplyr")
library(dplyr)
library(ggplot2)
x_mid<-mean(c(max(Df[2],na.rm=TRUE),min(Df[2],na.rm=TRUE)))
y_mid<-mean(c(max(Df[3],na.rm=TRUE),min(Df[3],na.rm=TRUE)))
Df %>%
mutate(quadrant = case_when(Df[2]>x_mid & Df[3]>y_mid ~ "Q1",
Df[2]<=x_mid & Df[3]>y_mid~"Q2",
Df[2]<=x_mid & Df[3]<=y_mid~"Q3",
TRUE ~"Q4")) %>%
ggplot(aes(x=Df[2],y=Df[3],colour=Df[1]))+geom_vline(xintercept = x_mid)+geom_hline(yintercept=y_mid)+geom_point()
I used a for loop to create a correlation matrix, because I needed to use polychor to generate polychoric correaltions and I was only able to get polychor to correlate two variables at a time. Anyway, I created my own correlation table with the following code:
for(i in 1:ncol(gd2)) { for (j in 1:ncol(gd2)) { corVal
The table looks like this:
head(dtnew) Better Afraid Alive Bored Drop Empty Energy Happy Help Home Hope Memory Satis Spirit Worth TOT 1: 1.00 0.32 0.29 0.39 0.36 0.46 0.25 0.43 0.39 0.13 0.46 0.39 0.50 0.45 0.48 0.67 2: 0.32 1.00 0.25 0.20 0.24 0.30 0.23 0.30 0.43 0.15 0.44 0.28 0.31 0.29 0.34 0.62 3: 0.29 0.25 1.00 0.26 0.28 0.46 0.38 0.60 0.35 0.19 0.41 0.10 0.49 0.53 0.43 0.65 4: 0.39 0.20 0.26 1.00 0.36 0.56 0.31 0.36 0.39 0.16 0.32 0.23 0.39 0.35 0.44 0.67 5: 0.36 0.24 0.28 0.36 1.00 0.44 0.41 0.37 0.43 0.31 0.35 0.22 0.42 0.37 0.40 0.72 6: 0.46 0.30 0.46 0.56 0.44 1.00 0.32 0.55 0.51 0.18 0.45 0.17 0.62 0.52 0.64 0.75 >
But longer.
Here is the dput()
structure(list(Better = c(1, 0.32, 0.29, 0.39, 0.36, 0.46, 0.25, 0.43, 0.39, 0.13, 0.46, 0.39, 0.5, 0.45, 0.48, 0.67), Afraid = c(0.32, 1, 0.25, 0.2, 0.24, 0.3, 0.23, 0.3, 0.43, 0.15, 0.44, 0.28, 0.31, 0.29, 0.34, 0.62), Alive = c(0.29, 0.25, 1, 0.26, 0.28, 0.46, 0.38, 0.6, 0.35, 0.19, 0.41, 0.1, 0.49, 0.53, 0.43, 0.65), Bored = c(0.39, 0.2, 0.26, 1, 0.36, 0.56, 0.31, 0.36, 0.39, 0.16, 0.32, 0.23, 0.39, 0.35, 0.44, 0.67), Drop = c(0.36, 0.24, 0.28, 0.36, 1, 0.44, 0.41, 0.37, 0.43, 0.31, 0.35, 0.22, 0.42, 0.37, 0.4, 0.72 ), Empty = c(0.46, 0.3, 0.46, 0.56, 0.44, 1, 0.32, 0.55, 0.51, 0.18, 0.45, 0.17, 0.62, 0.52, 0.64, 0.75), Energy = c(0.25, 0.23, 0.38, 0.31, 0.41, 0.32, 1, 0.48, 0.37, 0.36, 0.31, 0.14, 0.4, 0.43, 0.38, 0.74), Happy = c(0.43, 0.3, 0.6, 0.36, 0.37, 0.55, 0.48, 1, 0.45, 0.21, 0.49, 0.22, 0.69, 0.84, 0.49, 0.8), Help = c(0.39, 0.43, 0.35, 0.39, 0.43, 0.51, 0.37, 0.45, 1, 0.2, 0.51, 0.32, 0.5, 0.44, 0.6, 0.73), Home = c(0.13, 0.15, 0.19, 0.16, 0.31, 0.18, 0.36, 0.21, 0.2, 1, 0.23, 0.13, 0.13, 0.15, 0.26, 0.63), Hope = c(0.46, 0.44, 0.41, 0.32, 0.35, 0.45, 0.31, 0.49, 0.51, 0.23, 1, 0.38, 0.48, 0.47, 0.59, 0.73), Memory = c(0.39, 0.28, 0.1, 0.23, 0.22, 0.17, 0.14, 0.22, 0.32, 0.13, 0.38, 1, 0.25, 0.24, 0.31, 0.66), Satis = c(0.5, 0.31, 0.49, 0.39, 0.42, 0.62, 0.4, 0.69, 0.5, 0.13, 0.48, 0.25, 1, 0.66, 0.6, 0.78), Spirit = c(0.45, 0.29, 0.53, 0.35, 0.37, 0.52, 0.43, 0.84, 0.44, 0.15, 0.47, 0.24, 0.66, 1, 0.51, 0.77), Worth = c(0.48, 0.34, 0.43, 0.44, 0.4, 0.64, 0.38, 0.49, 0.6, 0.26, 0.59, 0.31, 0.6, 0.51, 1, 0.77), TOT = c(0.67, 0.62, 0.65, 0.67, 0.72, 0.75, 0.74, 0.8, 0.73, 0.63, 0.73, 0.66, 0.78, 0.77, 0.77, 0.89)), row.names = c(NA, -16L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x000001d7adc21ef0>)
</pre/>
I would like to generate a visual using corrplot. However, when I try, I get an error:
Error in is.finite(tmp) : default method not implemented for type ‘list’My data is indeed of type list. I have tried usuing ‘unlist’. Not sure what else to try.
Solution
There is a problem with your
dput()
output, possibly because you have a data.table. I can read it by deleting ", .internal.selfref = <pointer: 0x000001d7adc21ef0>" from the last line so that it endsclass = c("data.table", "data.frame"))
. Printing that out shows a problem with the last line/column (Tot
). The bottom row in that column should be 1.00, but it is 0.89. We can trim that and useas.matrix
(my mistake in the earlier comment) to convert the data frame:gd3 <- gd2[-16, -16] corrplot(as.matrix(gd3))