Tidyr's crossing() function not producing expected names in output - r

I apologize in advance that I could not create a reproducible example, but when I do tidyr::crossing on some dataframes, I get a crossed tibble where the x variables have the form: x$col_name and the y variables have y$col_name. If I do:
crossing(iris,mtcars)
I get names that don't have the x$ prefix, as desired. I checked that the class of the input dataframes are the same as the example above, and there are no duplicate names in the example I'm working with. I can't share the data for the usual privacy reasons. I realize there is not much to work with here, but I'm hoping someone here is experience enough with tidyr to understand this issue.
Here is some session info:
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] writexl_1.4.0 readxl_1.4.0 lubridate_1.8.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9
[7] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 ggplot2_3.3.6 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] cellranger_1.1.0 pillar_1.7.0 compiler_4.2.0 dbplyr_2.2.0 tools_4.2.0
[6] jsonlite_1.8.0 lifecycle_1.0.1 gtable_0.3.0 pkgconfig_2.0.3 rlang_1.0.2
[11] reprex_2.0.1 rstudioapi_0.13 DBI_1.1.3 cli_3.3.0 haven_2.5.0
[16] xml2_1.3.3 withr_2.5.0 httr_1.4.3 fs_1.5.2 generics_0.1.2
[21] vctrs_0.4.1 hms_1.1.1 grid_4.2.0 tidyselect_1.1.2 glue_1.6.2
[26] R6_2.5.1 fansi_1.0.3 tzdb_0.3.0 modelr_0.1.8 magrittr_2.0.3
[31] backports_1.4.1 scales_1.2.0 ellipsis_0.3.2 rvest_1.0.2 assertthat_0.2.1
[36] colorspace_2.0-3 utf8_1.2.2 stringi_1.7.6 munsell_0.5.0 broom_0.8.0
[41] crayon_1.5.1

Okay, the answer is simple:
crossing(iris,mtcars)
crossing(x = iris,y = mtcars)
This is rather odd behavior in my opinion.

Related

mapdeck R when using fill_colour the session crashes in Rstudio

As the title says when I use the fill_colour parameter my session crashes.
For example if I take from the Colours section of the mapdeck site and run
library(mapdeck)
library(sf)
sf <- spatialwidget::widget_melbourne
mapdeck() %>%
add_polygon(
data = sf
, fill_colour = "SA2_NAME"
)
Then the system crashes with "R Session Aborted"
If I amend the above to just
library(mapdeck)
library(sf)
sf <- spatialwidget::widget_melbourne
mapdeck() %>%
add_polygon(
data = sf
)
then the plot comes out without an error.
If I go to the logs from the help menu in Rstudio then there's nothing about the crash.
What should I be checking, removing, reinstalling, etc?
sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] units_0.8-0 dplyr_1.0.9 jsonify_1.2.1 RColorBrewer_1.1-3 sf_1.0-8 mapdeck_0.3.4 stringr_1.4.0 arrow_8.0.0
[9] webshot2_0.1.0 ggplot2_3.3.6 glue_1.6.2 magrittr_2.0.3 flextable_0.7.0 data.table_1.14.2 lubridate_1.8.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 class_7.3-20 ps_1.7.0 assertthat_0.2.1 digest_0.6.29 utf8_1.2.2 R6_2.5.1 evaluate_0.15
[9] e1071_1.7-9 pillar_1.7.0 gdtools_0.2.4 rlang_1.0.2 uuid_1.1-0 rmarkdown_2.14 htmlwidgets_1.5.4 bit_4.0.4
[17] munsell_0.5.0 proxy_0.4-26 compiler_4.2.0 xfun_0.31 pkgconfig_2.0.3 systemfonts_1.0.4 base64enc_0.1-3 htmltools_0.5.2
[25] spatialwidget_0.2.3 websocket_1.4.1 tidyselect_1.1.2 tibble_3.1.7 fansi_1.0.3 crayon_1.5.1 withr_2.5.0 later_1.3.0
[33] grid_4.2.0 jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2 scales_1.2.0 KernSmooth_2.23-20 zip_2.2.0
[41] cli_3.3.0 stringi_1.7.6 promises_1.2.0.1 xml2_1.3.3 ellipsis_0.3.2 generics_0.1.2 vctrs_0.4.1 tools_4.2.0
[49] bit64_4.0.5 officer_0.4.2 purrr_0.3.4 processx_3.5.3 fastmap_1.1.0 yaml_2.3.5 chromote_0.1.0 colorspace_2.0-3
[57] classInt_0.4-3 knitr_1.39

Any error found in R responds with Error in app$vspace(new_style$`margin-top` %||% 0) : attempt to apply non-function

I honestly don't know how to make this reproducible. Any error that occurs in R, using tidyverse throws:
Error in app$vspace(new_style$`margin-top` %||% 0) :
attempt to apply non-function
Has anybody else seen this?
Edit:
Here is the sessionInfo() output:
R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstatix_0.7.0 plotly_4.10.0 ggpubr_0.4.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.4 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.0.6
[11] ggplot2_3.3.5 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 lubridate_1.7.10 assertthat_0.2.1 digest_0.6.29 utf8_1.1.4 R6_2.5.1 cellranger_1.1.0 backports_1.2.1 reprex_2.0.1
[10] evaluate_0.15 httr_1.4.2 pillar_1.7.0 rlang_1.0.2 lazyeval_0.2.2 readxl_1.3.1 rstudioapi_0.13 data.table_1.14.2 car_3.0-12
[19] rmarkdown_2.13 labeling_0.4.2 htmlwidgets_1.5.4 munsell_0.5.0 broom_0.7.12 xfun_0.30 compiler_4.0.4 modelr_0.1.8 pkgconfig_2.0.3
[28] htmltools_0.5.2 tidyselect_1.1.2 fansi_0.4.2 viridisLite_0.4.0 crayon_1.5.1 tzdb_0.3.0 dbplyr_2.1.1 withr_2.5.0 grid_4.0.4
[37] jsonlite_1.7.2 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2 magrittr_2.0.1 scales_1.1.1 cli_3.2.0 stringi_1.5.3 carData_3.0-5
[46] farver_2.1.0 ggsignif_0.6.3 fs_1.5.0 xml2_1.3.2 ellipsis_0.3.2 generics_0.1.2 vctrs_0.4.0 tools_4.0.4 glue_1.4.2
[55] hms_1.1.1 yaml_2.3.5 abind_1.4-5 fastmap_1.1.0 colorspace_2.0-0 rvest_1.0.2 knitr_1.38 haven_2.3.1

R studio just stops plotting - repeatedly, how to fix

I have a recurring problem where R studio just stops plotting. The code for plots works fine, as the plots are saving to file, but they just stop showing up in the plot pane.
Restarting the whole session seems to fix, but then I have to reload everything and it happens again almost immediately.
Would be grateful for any insight.
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] RColorBrewer_1.1-2 pheatmap_1.0.12 stringr_1.4.0 gplots_3.1.1 viridis_0.5.1
[6] viridisLite_0.3.0 VennDiagram_1.6.20 futile.logger_1.4.3 tibble_3.0.5 fuzzyjoin_0.1.6
[11] ggthemes_4.2.4 tidyr_1.1.2 dplyr_1.0.3 data.table_1.13.6 readr_1.4.0
[16] ggVennDiagram_0.3 ggrepel_0.9.1 ggplot2_3.3.3 cowplot_1.1.1
loaded via a namespace (and not attached):
[1] gtools_3.8.2 tidyselect_1.1.0 purrr_0.3.4 sf_0.9-7 colorspace_2.0-0
[6] vctrs_0.3.6 generics_0.1.0 utf8_1.1.4 rlang_0.4.10 e1071_1.7-4
[11] pillar_1.4.7 glue_1.4.2 withr_2.4.0 DBI_1.1.1 lambda.r_1.2.4
[16] lifecycle_0.2.0 munsell_0.5.0 gtable_0.3.0 caTools_1.18.1 labeling_0.4.2
[21] class_7.3-17 fansi_0.4.2 Rcpp_1.0.6 KernSmooth_2.23-17 scales_1.1.1
[26] classInt_0.4-3 formatR_1.7 farver_2.0.3 gridExtra_2.3 digest_0.6.27
[31] hms_1.0.0 stringi_1.5.3 cli_2.2.0 tools_4.0.3 bitops_1.0-6
[36] magrittr_2.0.1 futile.options_1.0.1 crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.1
[41] assertthat_0.2.1 rstudioapi_0.13 R6_2.5.0 units_0.6-7 compiler_4.0.3

Error message in R (4.0.2) while using the filterandTrim function in dada2

Error message:
: Error in validObject(.Object) : invalid class “ScalarCharacter”
object: superclass "characterORconnection" not defined in the
environment of the object's class
I downloaded dada2 via biocManager.
The code is as follows (where all arguments are previously defined) :
out <- filterAndTrim(fnFs, filtFs, fnRs, filtRs, truncLen=250,
maxN=0, maxEE=1, truncQ=2, rm.phix=TRUE,
compress=TRUE, multithread=TRUE)
I was running into the same problem, also installing the package through biocManager.
After reading this long thread on GitHub where they also mention dada2, I tried to update R to its latest release, then I reinstalled BiocManager and dada2. Everything was running smoothly after that.
Session info WHEN I HAD PROBLEMS:
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dada2_1.16.0 Rcpp_1.0.6
loaded via a namespace (and not attached):
[1] SummarizedExperiment_1.18.2 tidyselect_1.1.1 purrr_0.3.4
[4] reshape2_1.4.4 lattice_0.20-41 colorspace_2.0-1
[7] vctrs_0.3.8 generics_0.1.0 stats4_4.0.3
[10] utf8_1.2.1 rlang_0.4.11 pillar_1.6.1
[13] glue_1.4.2 DBI_1.1.1 BiocParallel_1.22.0
[16] BiocGenerics_0.38.0 RColorBrewer_1.1-2 matrixStats_0.59.0
[19] jpeg_0.1-8.1 GenomeInfoDbData_1.2.4 lifecycle_1.0.0
[22] plyr_1.8.6 stringr_1.4.0 zlibbioc_1.36.0
[25] Biostrings_2.58.0 munsell_0.5.0 gtable_0.3.0
[28] hwriter_1.3.2 labeling_0.4.2 latticeExtra_0.6-29
[31] Biobase_2.48.0 IRanges_2.24.1 GenomeInfoDb_1.26.7
[34] parallel_4.0.3 fansi_0.5.0 scales_1.1.1
[37] BiocManager_1.30.16 DelayedArray_0.14.1 S4Vectors_0.28.1
[40] RcppParallel_5.1.4 XVector_0.30.0 ShortRead_1.46.0
[43] farver_2.1.0 Rsamtools_2.4.0 digest_0.6.27
[46] ggplot2_3.3.5 png_0.1-7 stringi_1.5.3
[49] dplyr_1.0.7 GenomicRanges_1.40.0 grid_4.0.3
[52] tools_4.0.3 bitops_1.0-7 magrittr_2.0.1
[55] RCurl_1.98-1.3 tibble_3.1.2 crayon_1.4.1
[58] pkgconfig_2.0.3 ellipsis_0.3.2 Matrix_1.2-18
[61] assertthat_0.2.1 rstudioapi_0.13 R6_2.5.0
[64] GenomicAlignments_1.24.0 compiler_4.0.3
Session info WITHOUT PROBLEMS:
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dada2_1.20.0 Rcpp_1.0.6
loaded via a namespace (and not attached):
[1] SummarizedExperiment_1.22.0 tidyselect_1.1.1 reshape2_1.4.4 purrr_0.3.4
[5] lattice_0.20-44 colorspace_2.0-2 vctrs_0.3.8 generics_0.1.0
[9] stats4_4.1.0 utf8_1.2.1 rlang_0.4.11 pillar_1.6.1
[13] glue_1.4.2 DBI_1.1.1 BiocParallel_1.26.1 BiocGenerics_0.38.0
[17] RColorBrewer_1.1-2 plyr_1.8.6 matrixStats_0.59.0 jpeg_0.1-8.1
[21] GenomeInfoDbData_1.2.6 lifecycle_1.0.0 stringr_1.4.0 zlibbioc_1.38.0
[25] MatrixGenerics_1.4.0 Biostrings_2.60.1 munsell_0.5.0 gtable_0.3.0
[29] hwriter_1.3.2 latticeExtra_0.6-29 Biobase_2.52.0 IRanges_2.26.0
[33] GenomeInfoDb_1.28.1 parallel_4.1.0 fansi_0.5.0 scales_1.1.1
[37] DelayedArray_0.18.0 S4Vectors_0.30.0 RcppParallel_5.1.4 XVector_0.32.0
[41] ShortRead_1.50.0 Rsamtools_2.8.0 ggplot2_3.3.5 png_0.1-7
[45] stringi_1.6.2 dplyr_1.0.7 GenomicRanges_1.44.0 grid_4.1.0
[49] tools_4.1.0 bitops_1.0-7 magrittr_2.0.1 RCurl_1.98-1.3
[53] tibble_3.1.2 crayon_1.4.1 pkgconfig_2.0.3 ellipsis_0.3.2
[57] Matrix_1.3-4 assertthat_0.2.1 rstudioapi_0.13 R6_2.5.0
[61] GenomicAlignments_1.28.0 compiler_4.1.0

Huxtable package for R: How to correctly reference huxtables in bookdown when outputting to Word

Using the example here, I am able to create a table & reference it using huxtable & bookdown as long as I output to pdf. The same does not seem to work with MS word.
Here is my sessionInfo in case it helps:
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
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
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 compiler_3.6.1 pillar_1.4.2 prettyunits_1.0.2
[5] tools_3.6.1 digest_0.6.25 packrat_0.5.0 pkgbuild_1.0.6
[9] lifecycle_0.2.0 evaluate_0.14 tibble_2.1.3 gtable_0.3.0
[13] pkgconfig_2.0.3 rlang_0.4.6 cli_2.0.2 rstudioapi_0.11
[17] parallel_3.6.1 yaml_2.2.0 xfun_0.10 loo_2.1.0
[21] gridExtra_2.3 dplyr_1.0.0 knitr_1.28 generics_0.0.2
[25] vctrs_0.3.1 tidyselect_1.1.0 stats4_3.6.1 grid_3.6.1
[29] glue_1.4.1 inline_0.3.15 R6_2.4.0 processx_3.4.1
[33] fansi_0.4.0 rmarkdown_2.3 bookdown_0.20 rstan_2.19.2
[37] purrr_0.3.3 callr_3.4.3 ggplot2_3.3.1 magrittr_1.5
[41] matrixStats_0.55.0 scales_1.0.0 ps_1.3.0 htmltools_0.4.0
[45] StanHeaders_2.19.0 assertthat_0.2.1 colorspace_1.4-1 munsell_0.5.0
[49] crayon_1.3.4
After additional searching, I found two solutions here and here. The easiest
solution is to use tab.cap as a chunk option:
```{r foo, echo=FALSE, tab.cap="Got it!"}
hux(a = 1:5, b = 1:5)
```

Resources