I am working on a RMarkdown and when I print dfs inline (within RStudio not after Knitting) they print like this
Before, dfs would print as beautiful paginated tables that looked like this:
I don't know what setting I am looking for, where or how to change it. How do I go back?
I recently updated R and now working on:
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.3
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.5 bindrcpp_0.2.2 ggthemes_4.0.1 cowplot_0.9.3 lavaan_0.6-3 ggplot2_3.1.0 pwr_1.2-2
[8] knitr_1.21 kableExtra_0.9.0 effsize_0.7.1 magrittr_1.5 dplyr_0.7.8 tidyr_0.8.2 readr_1.3.0
[15] lmerTest_3.0-1 lme4_1.1-19 Matrix_1.2-14
loaded via a namespace (and not attached):
[1] tidyselect_0.2.5 xfun_0.4 purrr_0.2.5 splines_3.5.1 lattice_0.20-35
[6] colorspace_1.3-2 stats4_3.5.1 htmltools_0.3.6 viridisLite_0.3.0 yaml_2.2.0
[11] rlang_0.3.0.1 nloptr_1.2.1 pillar_1.3.1 withr_2.1.2 glue_1.3.0
[16] RColorBrewer_1.1-2 flexdashboard_0.5.1.1 bindr_0.1.1 plyr_1.8.4 stringr_1.3.1
[21] munsell_0.5.0 gtable_0.2.0 rvest_0.3.2 htmlwidgets_1.3 evaluate_0.12
[26] labeling_0.3 highr_0.7 Rcpp_1.0.0 scales_1.0.0 jsonlite_1.6
[31] mnormt_1.5-5 hms_0.4.2 digest_0.6.18 stringi_1.2.4 numDeriv_2016.8-1
[36] grid_3.5.1 tools_3.5.1 lazyeval_0.2.1 tibble_1.4.2 pbivnorm_0.6.0
[41] crayon_1.3.4 pkgconfig_2.0.2 MASS_7.3-50 xml2_1.2.0 assertthat_0.2.0
[46] minqa_1.2.4 rmarkdown_1.11 httr_1.4.0 rstudioapi_0.8 boot_1.3-20
[51] R6_2.3.0 nlme_3.1-137 compiler_3.5.1
I figured it out and wanted to document in case someone runs into this problem. It was due to a bug that was fixed on the latest version of RStudio. You can learn more about the bug and download the latest version of RStudio to fix the problem.
Related
I have read the similar questions and answers on Stack Overflow but have not cracked this issue. I could be doing something wrong based on those prior answers and just need further guidance. I've included the sessionInfo() below.
Problem
Using RStudio on a MacOS, I have the spacyr loaded. I also have miniconda installed on my computer. However, after running:
spacy_initialize()
I get:
Error: Python shared library not found, Python bindings not loaded.
Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment.
Which is puzzling since I have miniconda installed. I'm guessing that when I downloaded miniconda, I didn't do it as a "shared environment". Perhaps something is getting messed up because my 2017 Macbook came preloaded with an old version of Python, whereas the minconda one is Python 3.9.
I don't know. I'm prepared to do some uninstall/reinstalls and go into the terminal if necessary, but people might have to explain it to me like I'm five.
I appreciate the help.
sessionInfo()
R version 4.1.1 (2021-08-10) Platform: x86_64-apple-darwin17.0
(64-bit) Running under: macOS Big Sur 11.6
Matrix products: default LAPACK:
/Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale: [1]
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils
datasets methods base
other attached packages: [1] reticulate_1.22 spacyr_1.2.1
textrecipes_0.4.1 recipes_0.1.17 [5] cleanNLP_3.0.3
hunspell_3.0.1 SnowballC_0.7.0 gt_0.3.1 [9]
magrittr_2.0.1 rmarkdown_2.11 htmltools_0.5.2 rlang_0.4.12
[13] stopwords_2.2 quanteda_3.1.0 text2vec_0.6
corpus_0.10.2 [17] bench_1.1.1 jiebaR_0.11 jiebaRD_0.1
janeaustenr_0.1.5 [21] hcandersenr_0.2.0 tidytext_0.3.2
forcats_0.5.1 stringr_1.4.0 [25] dplyr_1.0.7 purrr_0.3.4
readr_2.0.2 tidyr_1.1.4 [29] tibble_3.1.5
ggplot2_3.3.5 tidyverse_1.3.1 tokenizers_0.2.1
loaded via a namespace (and not attached): [1] colorspace_2.0-2
ellipsis_0.3.2 class_7.3-19 [4] rprojroot_2.0.2
fs_1.5.0 rstudioapi_0.13 [7] listenv_0.8.0
remotes_2.4.1 prodlim_2019.11.13 [10] fansi_0.5.0
lubridate_1.8.0 xml2_1.3.2 [13] codetools_0.2-18
splines_4.1.1 cachem_1.0.6 [16] rsparse_0.4.0
knitr_1.36 pkgload_1.2.3 [19] mlapi_0.1.0
jsonlite_1.7.2 RhpcBLASctl_0.21-247 [22] broom_0.7.9
dbplyr_2.1.1 png_0.1-7 [25] compiler_4.1.1
httr_1.4.2 backports_1.2.1 [28] assertthat_0.2.1
Matrix_1.3-4 fastmap_1.1.0 [31] cli_3.0.1
prettyunits_1.1.1 tools_4.1.1 [34] gtable_0.3.0
glue_1.4.2 float_0.2-6 [37] fastmatch_1.1-3
Rcpp_1.0.7 cellranger_1.1.0 [40] vctrs_0.3.8
timeDate_3043.102 xfun_0.27 [43] gower_0.2.2
globals_0.14.0 ps_1.6.0 [46] testthat_3.1.0
rvest_1.0.2 lifecycle_1.0.1 [49] devtools_2.4.2
future_1.22.1 MASS_7.3-54 [52] scales_1.1.1
ipred_0.9-12 lgr_0.4.3 [55] hms_1.1.1
parallel_4.1.1 yaml_2.2.1 [58] memoise_2.0.0
rpart_4.1-15 stringi_1.7.5 [61] desc_1.4.0
pkgbuild_1.2.0 lava_1.6.10 [64] pkgconfig_2.0.3
evaluate_0.14 lattice_0.20-45 [67] processx_3.5.2
tidyselect_1.1.1 parallelly_1.28.1 [70] R6_2.5.1
generics_0.1.0 DBI_1.1.1 [73] pillar_1.6.4
haven_2.4.3 withr_2.4.2 [76] nnet_7.3-16
survival_3.2-13 future.apply_1.8.1 [79] modelr_0.1.8
crayon_1.4.1 utf8_1.2.2 [82] tzdb_0.1.2
usethis_2.1.0 grid_4.1.1 [85] readxl_1.3.1
data.table_1.14.2 callr_3.7.0 [88] reprex_2.0.1
digest_0.6.28 RcppParallel_5.1.4 [91] munsell_0.5.0
sessioninfo_1.1.1
Someone provided me with a solution.
Have loaded: reticulate and spacyr packages.
Turns out that the reticulate package doesn't follow the standard way of indicating which version of Python you'd like to use, at least on a Mac OS, which has a system-level default that R wants to use.
The workaround is to set the system environment variable to tell reticulate to the attach the desired conda environment.
Sys.setenv( RETICULATE_PYTHON = with(conda_list(), python[ name == "spacy_condaenv" ]))
Next, run spacy_initialize(). Should work now.
Going forward, you'll need to put the Sys.setenv code (as written above) at the top of your script so that R sets the system environment to your liking right when you start a session.
I ran into the super slow problem last Friday, then for 3 days it worked, and now it is back again.
At first I thought it was the internet connection, but that seems not to be the case.
I've already tried various things such as:
- reinstall RStudio
- Reboot PC several times
- Use a different internet network
- remove all .RData and .RHistory files that I could find
but it is still going at crawl speed.
This morning it was running as expected, a few hours later at work, same laptop, it is super slow again.
I have virtually no other programs open, and it is slow straight from the start after a reboot every single time.
Does anyone have any suggestions how to figure out what is causing this, and how to solve it?
I'm running Version 1.1.463 of RStudio on a windows 7 professional.
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] flowPeaks_1.26.0 PerformanceAnalytics_1.5.2 xts_0.11-2 zoo_1.8-4 gtools_3.8.1
[6] lemon_0.4.3 gridExtra_2.3 pryr_0.1.4 scales_1.0.0 stringi_1.3.1
[11] V8_2.0 taRifx_1.0.6.1 webshot_0.5.1 broom_0.5.1 forcats_0.4.0
[16] stringr_1.4.0 dplyr_0.8.0.1 purrr_0.3.1 readr_1.3.1 tibble_2.0.1
[21] tidyverse_1.2.1 randomForest_4.6-14 yaml_2.2.0 plyr_1.8.4 colourpicker_1.0
[26] DT_0.5 tidyr_0.8.3 htmlwidgets_1.3 plotly_4.8.0 ggplot2_3.1.0
[31] bit64_0.9-7 bit_1.1-14 lubridate_1.7.4 shinyWidgets_0.4.5 shinyjqui_0.3.2
[36] shinyjs_1.0 shinydashboard_0.7.1 shinyBS_0.61 data.table_1.12.0 shiny_1.2.0
loaded via a namespace (and not attached):
[1] httr_1.4.0 jsonlite_1.6 viridisLite_0.3.0 modelr_0.1.4 assertthat_0.2.0 cellranger_1.1.0 pillar_1.3.1 backports_1.1.3
[9] lattice_0.20-38 quadprog_1.5-5 glue_1.3.0 digest_0.6.18 promises_1.0.1 rvest_0.3.2 colorspace_1.4-0 htmltools_0.3.6
[17] httpuv_1.4.5.1 pkgconfig_2.0.2 haven_2.1.0 xtable_1.8-3 later_0.8.0 generics_0.0.2 withr_2.1.2 lazyeval_0.2.1
[25] cli_1.0.1 magrittr_1.5 crayon_1.3.4 readxl_1.3.0 mime_0.6 nlme_3.1-137 xml2_1.2.0 tools_3.5.2
[33] hms_0.4.2 munsell_0.5.0 compiler_3.5.2 rlang_0.3.1 rstudioapi_0.9.0 crosstalk_1.0.0 miniUI_0.1.1.1 gtable_0.2.0
[41] codetools_0.2-15 curl_3.3 reshape2_1.4.3 R6_2.4.0 knitr_1.22 Rcpp_1.0.0 xfun_0.5 tidyselect_0.2.5
I was having the same problems in my RStudio Desktop IDE. The main problem was that it was extremely slow to start the IDE and perform trivial tasks like opening a script or using the console to perform basic calculations. Doing some research, this is what helped me:
Resetting RStudio Desktop's State.
Running a Diagnostic Report. My issue was that my HOME environmental variable was set to a network/shared drive (i.e. OneDrive).
I fixed this by setting my HOME env variable to a local directory. Check this solution. Check this thread for more background.
Good luck!
This question already has an answer here:
RMarkdown: ! Package pdftex.def Error; online image not found?
(1 answer)
Closed 4 years ago.
ETA: I don't know if this makes a difference, but a couple days ago, I upgraded/updated my Linux packages. I have had issues in the past where that causes some issues in R/RStudio.
Strange happenings with bookdown. Just a couple days ago, bookdown was building my book beautifully. Now, when I try to build my book, it seems that knitr::include_graphics() is creating an issue, but only if it points to an image URL.
I created a new bookdown project to see if the problem would persist; it did. bookdown built Yihui's minimal example perfectly. Then, I used knitr::include_graphics() to add an image file in the book's directory. Again, in that case, bookdown built the book, and everything worked just right. But, when I changed the image location to a URL, the error message reads:
! LaTeX Error: File
`https://upload.wikimedia.org/wikipedia/commons/2/2e/Charle
s_Darwin_seated_crop' not found.
Error: Failed to compile testbook.tex. See testbook.log for more info.
Execution halted
Exited with status 1.
I am at a loss. The only thing I'm changing is whether the include_graphics() command is using a local file versus one at a URL. Any suggestions are appreciated. Here is my session info:
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics utils datasets grDevices
[6] methods base
other attached packages:
[1] ggthemr_1.1.0 mapdata_2.3.0
[3] maps_3.3.0 BRugs_0.9-0
[5] bookdown_0.8.2 blogdown_0.9
[7] rasterImage_0.3.0 plotrix_3.7-4
[9] rasterVis_0.45 latticeExtra_0.6-28
[11] lattice_0.20-38 gridExtra_2.3
[13] rgeos_0.4-2 dismo_1.1-4
[15] RColorBrewer_1.1-2 ggthemes_4.0.1
[17] R2OpenBUGS_3.2-3.2 popbio_2.4.4
[19] demogR_0.6.0 png_0.1-7
[21] jpeg_0.1-8 rnaturalearthhires_0.1.0
[23] rnaturalearthdata_0.1.0 rnaturalearth_0.1.0
[25] raster_2.8-4 rgdal_1.3-6
[27] scales_1.0.0 ggmap_2.7.904
[29] ggvis_0.4.4 rworldmap_1.3-7
[31] maptools_0.9-4 sp_1.3-1
[33] googlesheets_0.3.0 forcats_0.3.0
[35] stringr_1.3.1 dplyr_0.7.8
[37] purrr_0.2.5 readr_1.3.0
[39] tidyr_0.8.2 tibble_1.4.2
[41] ggplot2_3.1.0 tidyverse_1.2.1
loaded via a namespace (and not attached):
[1] nlme_3.1-137 bitops_1.0-6 sf_0.7-1
[4] lubridate_1.7.4 httr_1.4.0 tools_3.4.4
[7] backports_1.1.2 R6_2.3.0 spData_0.2.9.6
[10] DBI_1.0.0 lazyeval_0.2.1 colorspace_1.3-2
[13] withr_2.1.2 tidyselect_0.2.5 compiler_3.4.4
[16] cli_1.0.1 rvest_0.3.2 xml2_1.2.0
[19] hexbin_1.27.2 classInt_0.2-3 digest_0.6.18
[22] foreign_0.8-70 rmarkdown_1.11 pkgconfig_2.0.2
[25] htmltools_0.3.6 rlang_0.3.0.1 readxl_1.1.0
[28] rstudioapi_0.8 shiny_1.2.0 bindr_0.1.1
[31] generics_0.0.2 zoo_1.8-4 jsonlite_1.6
[34] magrittr_1.5 dotCall64_1.0-0 Rcpp_1.0.0
[37] munsell_0.5.0 yaml_2.2.0 stringi_1.2.4
[40] plyr_1.8.4 grid_3.4.4 parallel_3.4.4
[43] promises_1.0.1 crayon_1.3.4 haven_2.0.0
[46] hms_0.4.2 knitr_1.21 pillar_1.3.0
[49] boot_1.3-20 rjson_0.2.20 codetools_0.2-15
[52] glue_1.3.0 evaluate_0.12 modelr_0.1.2
[55] spam_2.2-0 httpuv_1.4.5 RgoogleMaps_1.4.3
[58] cellranger_1.1.0 gtable_0.2.0 assertthat_0.2.0
[61] xfun_0.4 mime_0.6 xtable_1.8-3
[64] broom_0.5.1 e1071_1.7-0 coda_0.19-2
[67] later_0.7.5 class_7.3-14 viridisLite_0.3.0
[70] fields_9.6 units_0.6-2 bindrcpp_0.2.2
Assuming you put
include_graphics("https://upload.wikimedia.org/wikipedia/commons/2/2e/Charles_Darwin_seated_crop.jpg")
in your document, then the issue is that LaTeX can't handle URLs. If you left the .jpg off, then that URL really doesn't exist.
You need to download the file and reference the local copy.
My shiny app works in my viewer but hangs when I deploy the app to shinyapps.io. In the files deployed to shinyapps.io are global.R, app.R, app.Rproj and /data (directory containing a subdirectory of 300 pdf files in total of about 800mb). I read the pdf data text and create a text analysis in global.R.
When trying to deploy all it does is
something like: preparing... DONE
Then it hangs forever on Uploading bundle for application: 413154..
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bindrcpp_0.2.2 DT_0.4 visdat_0.1.0 tidytext_0.1.8 broom_0.4.4 quanteda_1.3.4 tm_0.7-5
[8] NLP_0.1-11 pdftools_1.8 forcats_0.3.0 stringr_1.3.1 dplyr_0.7.6 purrr_0.2.5 readr_1.1.1
[15] tidyr_0.8.1 tibble_1.4.2 ggplot2_3.0.0 tidyverse_1.2.1 shiny_1.1.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.17 lubridate_1.7.4 lattice_0.20-35 assertthat_0.2.0 digest_0.6.15 psych_1.8.4
[7] mime_0.5 slam_0.1-43 R6_2.2.2 cellranger_1.1.0 plyr_1.8.4 httr_1.3.1
[13] pillar_1.2.2 rlang_0.2.0.9001 lazyeval_0.2.1 readxl_1.1.0 rstudioapi_0.7 data.table_1.10.4-3
[19] Matrix_1.2-14 labeling_0.3 foreign_0.8-70 htmlwidgets_1.2 munsell_0.4.3 janeaustenr_0.1.5
[25] spacyr_0.9.91 compiler_3.4.3 httpuv_1.4.3 modelr_0.1.2 pkgconfig_2.0.1 mnormt_1.5-5
[31] htmltools_0.3.6 tidyselect_0.2.4 crayon_1.3.4 withr_2.1.2 later_0.7.2 SnowballC_0.5.1
[37] grid_3.4.3 nlme_3.1-137 jsonlite_1.5.9000 xtable_1.8-2 gtable_0.2.0 magrittr_1.5
[43] tokenizers_0.2.1 scales_0.5.0.9000 RcppParallel_4.4.1 cli_1.0.0 stringi_1.2.4 reshape2_1.4.3
[49] promises_1.0.1 xml2_1.2.0 stopwords_0.9.0 fastmatch_1.1-0 tools_3.4.3 glue_1.2.0
[55] hms_0.4.2 rsconnect_0.8.8 parallel_3.4.3 yaml_2.2.0 colorspace_1.3-2 rvest_0.3.2
[61] bindr_0.1.1 haven_1.1.1
If you need additional things to help me, feel free to ask! Any help much appreciated!
It might seem elementary, but the problem is the size. I've deployed an app whose folder contained only a few KB's worth of files, and it took a pretty long time at the same Uploading bundle for application: xxxxx. Your app might also need a lot of libraries, as you have 19 loaded.
How can I open my getwd() folder directly from the R console? This is useful if I want to see something I've recently just exported there. A google search has revealed nothing and I don't have the capability to build a function.
If you actually want a file browser you could create a function to open the directory. This is done differently based on the operating system you're using but this should cover most bases
opendir <- function(dir = getwd()){
if (.Platform['OS.type'] == "windows"){
shell.exec(dir)
} else {
system(paste(Sys.getenv("R_BROWSER"), dir))
}
}
If you don't need it to be cross platform you can reduce it down to just the code for your OS. But if you just want to view the files in a given directory then using dir should be good enough.
You can use dir() or list.files() to display the files in the current working directory or file.choose() to browse the directory and choose a file. All three default to the current working directory.
I'd suggest using:
utils::browseURL(getwd())
Posting an answer because the above function did not work for me - got around it buusing a macOS terminal command via a system call from within R (session info below).
Function
opendir <- function(directory = getwd()){
system(sprintf('open %s', shQuote(directory)))
}
Session Info
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils
[5] datasets methods base
other attached packages:
[1] here_0.1 htmlwidgets_1.3
[3] openxlsx_4.1.0.1 tictoc_1.0
[5] plotly_4.9.0 jsonlite_1.6
[7] ggplot2_3.1.1 lubridate_1.7.4
[9] httr_1.4.0 data.table_1.12.2
loaded via a namespace (and not attached):
[1] zip_2.0.2 Rcpp_1.0.1
[3] RColorBrewer_1.1-2 later_0.8.0
[5] pillar_1.4.0 compiler_3.6.0
[7] plyr_1.8.4 tools_3.6.0
[9] digest_0.6.19 packrat_0.5.0
[11] tibble_2.1.1 gtable_0.3.0
[13] viridisLite_0.3.0 pkgconfig_2.0.2
[15] rlang_0.3.4 shiny_1.3.2
[17] rstudioapi_0.10 crosstalk_1.0.0
[19] yaml_2.2.0 withr_2.1.2
[21] dplyr_0.8.1 stringr_1.4.0
[23] rprojroot_1.3-2 grid_3.6.0
[25] tidyselect_0.2.5 glue_1.3.1
[27] R6_2.4.0 processx_3.3.1
[29] purrr_0.3.2 tidyr_0.8.3
[31] magrittr_1.5 ps_1.3.0
[33] promises_1.0.1 backports_1.1.4
[35] scales_1.0.0 htmltools_0.3.6
[37] assertthat_0.2.1 xtable_1.8-4
[39] mime_0.6 colorspace_1.4-1
[41] httpuv_1.5.1 labeling_0.3
[43] stringi_1.4.3 lazyeval_0.2.2
[45] munsell_0.5.0 crayon_1.3.4