StevenVB12 / patternize

An R package for quantifying color pattern variation
31 stars 8 forks source link

Cannot run example data Error in transformRef == "meanshape" || is.matrix(transformRef) : 'length = 36' in coercion to 'logical(1)' In addition: There were 12 warnings (use warnings() to see them) #40

Open RJGrayEcology opened 1 year ago

RJGrayEcology commented 1 year ago

load patternize library

library(patternize) library(raster) Loading required package: sp library(terra) terra 1.7.29

The viridis package provides colour blind friendly colour schemes

install.packages("viridis")

library(viridis)

List with samples

IDlist <- c('BC0004',

  • 'BC0049',
  • 'BC0050',
  • 'BC0071',
  • 'BC0077',
  • 'BC0079',
  • 'BC0082',
  • 'BC0125',
  • 'BC0129',
  • 'BC0366')

    make list with landmarks

    prepath <- 'landmarks/Heliconius' extension <- '_landmarks_LFW.txt' landmarkList <- makeList(IDlist, 'landmark', prepath, extension) [1] "sample 1 BC0004 added to list" [1] "sample 2 BC0049 added to list" [1] "sample 3 BC0050 added to list" [1] "sample 4 BC0071 added to list" [1] "sample 5 BC0077 added to list" [1] "sample 6 BC0079 added to list" [1] "sample 7 BC0082 added to list" [1] "sample 8 BC0125 added to list" [1] "sample 9 BC0129 added to list" [1] "sample 10 BC0366 added to list"

    make list with images

    prepath <- 'images/Heliconius' extension <- '-D.jpg' imageList <- makeList(IDlist, 'image', prepath, extension) [1] "sample 1 BC0004 added to list" [1] "sample 2 BC0049 added to list" [1] "sample 3 BC0050 added to list" [1] "sample 4 BC0071 added to list" [1] "sample 5 BC0077 added to list" [1] "sample 6 BC0079 added to list" [1] "sample 7 BC0082 added to list" [1] "sample 8 BC0125 added to list" [1] "sample 9 BC0129 added to list" [1] "sample 10 BC0366 added to list"

    tranformref

    target <- landmarkList[['BC0004']]

    run alignment of color patterns

    RGB <- c(114,17,0) # red rasterList_lanRGB <- patLanRGB(imageList, landmarkList, RGB, transformRef = target, resampleFactor = 3,

  • colOffset = 0.15, crop = TRUE, res = 200, adjustCoords = TRUE, plot = 'stack') [1] "sample 1 BC0004 added to array" [1] "sample 2 BC0049 added to array" [1] "sample 3 BC0050 added to array" [1] "sample 4 BC0071 added to array" [1] "sample 5 BC0077 added to array" [1] "sample 6 BC0079 added to array" [1] "sample 7 BC0082 added to array" [1] "sample 8 BC0125 added to array" [1] "sample 9 BC0129 added to array" [1] "sample 10 BC0366 added to array" Error in transformRef == "meanshape" || is.matrix(transformRef) : 'length = 36' in coercion to 'logical(1)' In addition: There were 12 warnings (use warnings() to see them)

sessionInfo() R version 4.3.0 (2023-04-21 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22621)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8

time zone: Asia/Bangkok tzcode source: internal

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

other attached packages: [1] viridis_0.6.3 viridisLite_0.4.2 patternize_0.0.3

loaded via a namespace (and not attached): [1] geomorph_4.0.5 gtable_0.3.3 xfun_0.39 ggplot2_3.4.2 raster_3.6-20 htmlwidgets_1.6.2 Rvcg_0.22.1
[8] lattice_0.21-8 vctrs_0.6.2 tools_4.3.0 generics_0.1.3 parallel_4.3.0 rgl_1.1.3 tibble_3.2.1
[15] fansi_1.0.4 cluster_2.1.4 pkgconfig_2.0.3 Matrix_1.5-4 lifecycle_1.0.3 compiler_4.3.0 stringr_1.5.0
[22] munsell_0.5.0 terra_1.7-29 tiff_0.1-11 codetools_0.2-19 permute_0.9-7 htmltools_0.5.5 gmp_0.7-1
[29] pillar_1.9.0 MASS_7.3-58.4 imager_0.45.2 vegan_2.6-4 iterators_1.0.14 abind_1.4-5 foreach_1.5.2
[36] RRPP_1.3.1 nlme_3.1-162 tidyselect_1.2.0 bmp_0.3 digest_0.6.31 stringi_1.7.12 dplyr_1.1.2
[43] purrr_1.0.1 splines_4.3.0 fastmap_1.1.1 grid_4.3.0 colorspace_2.1-0 cli_3.6.1 magrittr_2.0.3
[50] base64enc_0.1-3 utf8_1.2.3 ape_5.7-1 bezier_1.1.2 scales_1.2.1 sp_1.6-0 Morpho_2.11
[57] jpeg_0.1-10 igraph_1.4.3 gridExtra_2.3 png_0.1-8 knitr_1.42 rgdal_1.6-6 doParallel_1.0.17 [64] mgcv_1.8-42 rlang_1.1.1 readbitmap_0.1.5 Rcpp_1.0.10 glue_1.6.2 rstudioapi_0.14 jsonlite_1.8.4
[71] R6_2.5.1 ClusterR_1.3.1 colorRamps_2.3.1

jptumulty commented 1 year ago

I think this is an issue with new updates to R (version 4.3). See here: https://stackoverflow.com/questions/72848442/r-warning-lengthx-2-1-in-coercion-to-logical1

I am running R version 4.1.3 and don't get this error. It shows up as a warning with R version 4.2, and apparently just an error in R version 4.3. As a workaround, you could try going back to an earlier version of R.

StevenVB12 commented 1 year ago

Thanks James!

From: jptumulty @.> Sent: Monday, 14 August 2023 20:11 To: StevenVB12/patternize @.> Cc: Subscribed @.***> Subject: Re: [StevenVB12/patternize] Cannot run example data Error in transformRef == "meanshape" || is.matrix(transformRef) : 'length = 36' in coercion to 'logical(1)' In addition: There were 12 warnings (use warnings() to see them) (Issue #40)

I think this is an issue with new updates to R (version 4.3). See here: https://stackoverflow.com/questions/72848442/r-warning-lengthx-2-1-in-coercion-to-logical1

I am running R version 4.1.3 and don't get this error. It shows up as a warning with R version 4.2, and apparently just an error in R version 4.3. As a workaround, you could try going back to an earlier version of R.

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/40#issuecomment-1677836675, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC45HO3B3LKGKLKYXMR3XVJSZVANCNFSM6AAAAAAYRXBD7Y. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

StevenVB12 commented 1 year ago

Everything should now be compatible with R 4.3. Let me know if anything fails!

Steven

From: jptumulty @.> Sent: Monday, 14 August 2023 20:11 To: StevenVB12/patternize @.> Cc: Subscribed @.***> Subject: Re: [StevenVB12/patternize] Cannot run example data Error in transformRef == "meanshape" || is.matrix(transformRef) : 'length = 36' in coercion to 'logical(1)' In addition: There were 12 warnings (use warnings() to see them) (Issue #40)

I think this is an issue with new updates to R (version 4.3). See here: https://stackoverflow.com/questions/72848442/r-warning-lengthx-2-1-in-coercion-to-logical1

I am running R version 4.1.3 and don't get this error. It shows up as a warning with R version 4.2, and apparently just an error in R version 4.3. As a workaround, you could try going back to an earlier version of R.

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/40#issuecomment-1677836675, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC45HO3B3LKGKLKYXMR3XVJSZVANCNFSM6AAAAAAYRXBD7Y. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>