MomX / Momocs

:dove: Morphometrics using R
http://momx.github.io/Momocs/
51 stars 19 forks source link

CLUST(bp) error #102

Closed raz1 closed 8 years ago

raz1 commented 8 years ago

Hi,

I run the following example and get an error:

data(bot) bp <- PCA(efourier(bot, 10)) CLUST(bp) Error: Aesthetics must be either length 1 or the same as the data (79): x, y, xend, yend, colour

Why, can it be solved?

Thanks

vbonhomme commented 8 years ago

works on my machine... perhaps you may want to reinstall ggtree from its github repos.

2015-11-06 22:36 GMT+01:00 raz1 notifications@github.com:

Hi,

I run the following example and get an error:

data(bot) bp <- PCA(efourier(bot, 10)) CLUST(bp) Error: Aesthetics must be either length 1 or the same as the data (79): x, y, xend, yend, colour

Why, can it be solved?

Thanks

— Reply to this email directly or view it on GitHub https://github.com/vbonhomme/Momocs/issues/102.

vincentbonhomme.fr http://www.vincentbonhomme.fr

raz1 commented 8 years ago

As install_github("GuangchuangYu/ggtree") give this error: Error : object 'GeomPoint' is not exported by 'namespace:ggplot2' ERROR: lazy loading failed for package 'ggtree'

I tried the following script: library(devtools) install_github(c("hadley/ggplot2", "GuangchuangYu/ggtree"))

library(Momocs) library(ggplot2) library(ggtree)

data(bot) bp <- PCA(efourier(bot, 10)) CLUST(bp)

And I get this error. Error: Aesthetics must be either length 1 or the same as the data (79): x, y, xend, yend, colour

I think the problem lies in on the dependencies between ggplot2, ggtree and Momcs. Is it fixable?

vbonhomme commented 8 years ago

this has long been a problem... could you please copy paste the result of a sessionInfo() just before the error?

2015-11-07 10:23 GMT+01:00 raz1 notifications@github.com:

As install_github("GuangchuangYu/ggtree") give this error: Error : object 'GeomPoint' is not exported by 'namespace:ggplot2' ERROR: lazy loading failed for package 'ggtree'

I tried the following script: library(devtools) install_github(c("hadley/ggplot2", "GuangchuangYu/ggtree"))

library(Momocs) library(ggplot2) library(ggtree)

data(bot) bp <- PCA(efourier(bot, 10)) CLUST(bp, 1) + scale_color_discrete(h=c(120, 240))

And I get this error. Error: Aesthetics must be either length 1 or the same as the data (79): x, y, xend, yend, colour

I think the problem lies in on the dependencies between ggplot2, ggtree and Momcs. Is it fixable?

— Reply to this email directly or view it on GitHub https://github.com/vbonhomme/Momocs/issues/102#issuecomment-154668291.

vincentbonhomme.fr http://www.vincentbonhomme.fr

raz1 commented 8 years ago

Thanks for the reply:

sessionInfo() R version 3.1.3 (2015-03-09) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages: [1] ggplot2_1.0.1.9003 ggtree_1.3.3 Momocs_0.9.45 devtools_1.9.1

loaded via a namespace (and not attached): [1] ape_3.3 assertthat_0.1 BiocGenerics_0.12.1 BiocInstaller_1.16.5 [5] Biostrings_2.34.1 colorspace_1.2-6 curl_0.9.3 DBI_0.3.1
[9] digest_0.6.8 dplyr_0.4.3 geometry_0.3-6 grid_3.1.3
[13] gridExtra_2.0.0 gtable_0.1.2 httr_1.0.0 IRanges_2.0.1
[17] jpeg_0.1-8 jsonlite_0.9.17 knitr_1.11 lattice_0.20-30
[21] lazyeval_0.1.10 magic_1.5-6 magrittr_1.5 MASS_7.3-39
[25] memoise_0.2.1 munsell_0.4.2 nlme_3.1-120 parallel_3.1.3
[29] plyr_1.8.3 R6_2.1.1 Rcpp_0.12.1 reshape2_1.4.1
[33] rstudioapi_0.3.1 S4Vectors_0.4.0 scales_0.3.0 sp_1.2-1
[37] stats4_3.1.3 stringi_1.0-1 stringr_1.0.0 tools_3.1.3
[41] XVector_0.6.0 zlibbioc_1.12.0

raz1 commented 8 years ago

Furthermore this seems to be a related, running install_github(c( "GuangchuangYu/ggtree","hadley/ggplot2")) results: ... .* installing source package 'ggplot2' ... * R * data * moving datasets to lazyload DB * inst * tests * preparing package for lazy loading * help * installing help indices * building package indices * installing vignettes \ testing if installed package can be loaded * arch - i386 * arch - x64 .* DONE (ggplot2) Reloading installed ggplot2 unloadNamespace("ggplot2") not successful. Forcing unload.

Attaching package: ‘ggplot2’

The following objects are masked from ‘package:ggtree’:

aes, geom_text, ggplotGrob

vbonhomme commented 8 years ago

if library ggplot2, then ggtree then Momocs still doesnt work, I dont know how to solve it.

2015-11-07 14:31 GMT+01:00 raz1 notifications@github.com:

Furthermore this seems to be a related, running install_github(c( "GuangchuangYu/ggtree","hadley/ggplot2")) results: ...

  • installing source package 'ggplot2' ... * R * data * moving datasets to lazyload DB * inst * tests * preparing package for lazy loading * help * installing help indices \ building package indices installing vignettes \ testing if installed package can be loaded * arch
  • i386 *\ arch - x64
  • DONE (ggplot2) Reloading installed ggplot2 unloadNamespace("ggplot2") not successful. Forcing unload.

Attaching package: ‘ggplot2’

The following objects are masked from ‘package:ggtree’:

aes, geom_text, ggplotGrob

— Reply to this email directly or view it on GitHub https://github.com/vbonhomme/Momocs/issues/102#issuecomment-154704293.

vincentbonhomme.fr http://www.vincentbonhomme.fr

raz1 commented 8 years ago

Thanks a lot.

An alternative solution can be to use the script below but I do not know how to dist the PCA results? data(bot) bp <- PCA(efourier(bot, 10)) clustBOT <- dist(bp) # method="man" # is a bit better hcBot <- hclust(clustBOT, method = "complete")

Do you have an idea how to use external hierarchical clustering package?

vbonhomme commented 8 years ago

I thin a combination of hclust, dist would be fine. If you want to work on scores, they can be accessed with bp$x.