Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run example code error #35

Open
BioLaoXu opened this issue Jul 4, 2024 · 0 comments
Open

run example code error #35

BioLaoXu opened this issue Jul 4, 2024 · 0 comments

Comments

@BioLaoXu
Copy link

BioLaoXu commented Jul 4, 2024

dear geomnet team ,geomnet support for ggolot getwork plotly is indeed a nice thing, but I got an error when I tried to run the example code, and I was looking forward to this package working normally.

library(dplyr)
library(geomnet)
data(theme_elements)
# data step
TEnet <- fortify(as.edgedf(theme_elements$edges[,c("parent", "child")]), theme_elements$vertices)
# create a degree variable for use later
TEnet <- TEnet %>%
  group_by(from_id) %>%
  mutate(degree = sqrt(10 * n() + 1))
# plot
ggplot(data = TEnet,
       aes(from_id = from_id, to_id = to_id)) +
  geom_net(layout.alg = "fruchtermanreingold",
           aes(fontsize = degree), directed = TRUE,
           labelon = TRUE, size = 1, labelcolour = 'black',
           ecolour = "grey70", arrowsize = 0.5,
           linewidth = 0.5, repel = TRUE) +
  theme_net() +
  xlim(c(-0.05, 1.05))

###################################################################
###################################################################

Error in `geom_net()`:
! Problem while computing stat.
ℹ Error occurred in the 1st layer.
Caused by error:
! The first two columns of `x` must be of the same type.
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/rlang_error>
Error in `geom_net()`:
! Problem while computing stat.
ℹ Error occurred in the 1st layer.
Caused by error:
! The first two columns of `x` must be of the same type.
---
Backtrace:
     ▆
  1. ├─base (local) `<fn>`(x)
  2. └─ggplot2:::print.ggplot(x)
  3.   ├─ggplot2::ggplot_build(x)
  4.   └─ggplot2:::ggplot_build.ggplot(x)
  5.     └─ggplot2:::by_layer(...)
  6.       ├─rlang::try_fetch(...)
  7.       │ ├─base::tryCatch(...)
  8.       │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
  9.       │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 10.       │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 11.       │ └─base::withCallingHandlers(...)
 12.       └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
 13.         └─l$compute_statistic(d, layout)
 14.           └─ggplot2 (local) compute_statistic(..., self = self)
 15.             └─self$stat$compute_layer(data, self$computed_stat_params, layout)
 16.               └─geomnet (local) compute_layer(..., self = self)
 17.                 └─self$compute_panel(...)
 18.                   └─geomnet (local) compute_panel(..., self = self)
 19.                     └─self$compute_network(...)
 20.                       └─geomnet (local) compute_network(...)
 21.                         ├─network::as.network(na.omit(edges[, 1:2]), matrix.type = "edgelist")
 22.                         └─network::as.network.data.frame(na.omit(edges[, 1:2]), matrix.type = "edgelist")
 23.                           └─network:::.validate_edge_df(...)
 24.                             └─base::stop(...)
Run rlang::last_trace(drop = FALSE) to see 5 hidden frames.

I can't run successfully on both linux and window10 systems, the same error occurs,here is my running environment(win10)

> sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=Chinese (Simplified)_China.utf8  LC_CTYPE=Chinese (Simplified)_China.utf8   
[3] LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C                               
[5] LC_TIME=Chinese (Simplified)_China.utf8    

time zone: Asia/Shanghai
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] geomnet_0.3.1 ggplot2_3.5.1

loaded via a namespace (and not attached):
 [1] tidyr_1.3.1          plotly_4.10.4        utf8_1.2.4           generics_0.1.3       lattice_0.22-6      
 [6] stringi_1.7.6        hms_1.1.3            statnet.common_4.9.0 digest_0.6.29        magrittr_2.0.3      
[11] grid_4.4.1           pkgload_1.4.0        fastmap_1.2.0        jsonlite_1.8.8       network_1.18.2      
[16] pkgbuild_1.4.4       sessioninfo_1.2.2    urlchecker_1.0.1     promises_1.2.0.1     httr_1.4.7          
[21] purrr_1.0.2          fansi_1.0.6          viridisLite_0.4.2    scales_1.3.0         lazyeval_0.2.2      
[26] cli_3.6.2            shiny_1.8.1.1        rlang_1.1.3.9000     ellipsis_0.3.2       munsell_0.5.1       
[31] remotes_2.5.0        withr_3.0.0          cachem_1.0.6         devtools_2.4.5       tools_4.4.1         
[36] tzdb_0.4.0           coda_0.19-4.1        memoise_2.0.1        dplyr_1.1.4          colorspace_2.1-0    
[41] httpuv_1.6.5         curl_4.3.2           vctrs_0.6.5          R6_2.5.1             mime_0.12           
[46] lifecycle_1.0.4      stringr_1.5.1        fs_1.5.2             htmlwidgets_1.6.4    usethis_2.2.3       
[51] miniUI_0.1.1.1       sna_2.7-2            pkgconfig_2.0.3      pillar_1.9.0         later_1.3.0         
[56] gtable_0.3.5         data.table_1.14.2    glue_1.6.2           profvis_0.3.7        Rcpp_1.0.8.3        
[61] tibble_3.2.1         tidyselect_1.2.1     rstudioapi_0.16.0    xtable_1.8-4         htmltools_0.5.8.1   
[66] readr_2.1.5          compiler_4.4.1      
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant