I am trying to read a svg image (created with inkscape) with magick in R. From the introduction here, imagemagick can read svg image.
This is the svg image that I am trying to read.
https://www.dropbox.com/s/3dqcr7qr286m1k5/image.svg?dl=0
library(magrittr)
library(magick)
i <- "image.svg"
myimage <- image_read(i)
myimage
I can read the image successfully, but when I view the image in the Rstudio viewer, the image has some distortions especially in the labels.
Is there a way to avoid such distortions in svg image?
My Sys.info
sysname release
"Windows" "10 x64"
version nodename
"build 19041" "SUMANKHANAL"
machine login
"x86-64" "suman"
user effective_user
"suman" "suman"
sessionInfo
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices
[4] utils datasets methods
[7] base
other attached packages:
[1] magick_2.5.2 magrittr_2.0.1
[3] reprex_0.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 rstudioapi_0.13
[3] knitr_1.30 whisker_0.4
[5] R6_2.4.1 rlang_0.4.10
[7] tools_4.0.3 xfun_0.20
[9] tinytex_0.26 clipr_0.7.0
[11] htmltools_0.5.0 ellipsis_0.3.1
[13] digest_0.6.27 tibble_3.0.3
[15] lifecycle_0.2.0 crayon_1.3.4
[17] processx_3.4.4 callr_3.5.1
[19] vctrs_0.3.5 fs_1.5.0
[21] ps_1.3.4 evaluate_0.14
[23] rmarkdown_2.5 compiler_4.0.3
[25] pillar_1.4.6 pkgconfig_2.0.3
Related
I use the gt package to create and save a table that I produce. Recently, I have sometimes been getting the following error when I attempt to gtsave.
Error in s$close() : attempt to apply non-function
Here is session information:
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C 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.9 later_1.3.0 cellranger_1.1.0 pillar_1.8.1 compiler_4.1.1 tools_4.1.1
[7] digest_0.6.29 jsonlite_1.8.0 googledrive_2.0.0 lifecycle_1.0.2 gargle_1.2.1 tibble_3.1.8
[13] gtable_0.3.1 pkgconfig_2.0.3 rlang_1.0.5 svGUI_1.0.1 cli_3.4.0 rstudioapi_0.14
[19] commonmark_1.8.0 curl_4.3.2 fastmap_1.1.0 webshot2_0.1.0 dplyr_1.0.10 stringr_1.4.1
[25] generics_0.1.3 fs_1.5.2 vctrs_0.4.1 sass_0.4.2 svDialogs_1.1.0 websocket_1.4.1
[31] googlesheets4_1.0.1 grid_4.1.1 tidyselect_1.1.2 chromote_0.1.1 glue_1.6.2 R6_2.5.1
[37] processx_3.7.0 fansi_1.0.3 tidyr_1.2.1 purrr_0.3.4 ggplot2_3.3.6 magrittr_2.0.3
[43] ps_1.7.1 promises_1.2.0.1 scales_1.2.1 htmltools_0.5.3 ellipsis_0.3.2 gt_0.7.0
[49] colorspace_2.0-3 utf8_1.2.2 stringi_1.7.8 munsell_0.5.0
I can install.packages("webshot") again to and then re-run my code usually without issue. However, this isn't a great solution. Anyone have any suggestions? I have managed to recreate this issue on two different, independent computers (and code) after updating my R, Rstudio, and all of my packages.
Thanks!
I work with multiple locales/languages on Windows, and after my recent update to R 4.2, I keep seeing a warning " using locale code page other than 65001 ("UTF-8") may cause problems" whenever I try to set the system locale (and regardless of what language I try to set it to).
When I revert back to R 4.1.3, the warning doesn't appear.
Can anyone tell me what this warning means and whether there's anyway to get rid of it? Thanks!
> Sys.setlocale("LC_ALL","English")
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
Warning message:
In Sys.setlocale("LC_ALL", "English") :
using locale code page other than 65001 ("UTF-8") may cause problems
> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
system code page: 65001
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] fansi_1.0.3 assertthat_0.2.1 dplyr_1.0.9 utf8_1.2.2
[5] crayon_1.5.1 grid_4.2.0 R6_2.5.1 DBI_1.1.2
[9] lifecycle_1.0.1 gtable_0.3.0 magrittr_2.0.3 scales_1.2.0
[13] ggplot2_3.3.6 pillar_1.7.0 rlang_1.0.2 cli_3.3.0
[17] generics_0.1.2 vctrs_0.4.1 ellipsis_0.3.2 glue_1.6.2
[21] purrr_0.3.4 munsell_0.5.0 compiler_4.2.0 pkgconfig_2.0.3
[25] colorspace_2.0-3 tidyselect_1.1.2 tibble_3.1.7
>
I'm just trying to export my data using write.csv like you'd expect
write.csv(df, "df.csv")
and I'm getting this error:
"Error in app$vspace(new_style$`margin-top` %||% 0) : attempt to apply non-function."
I'm not sure how to troubleshoot this/solve the issue! I double checked that my data is a standard class (it's a data.frame), but beyond that I'm at a loss because it looks like every other data.frame I've ever (successfully) exported. I'm not an experienced error-reader, but if it's helpful, the top line of the traceback is this:
clii__container_start(app, "span", class = funname)
I also did all the basics like quitting and restarting my R session, moving my working directory around, and checking if other data.frames can export -- they can, it's just this one that's stuck.
Here's the output for sessionInfo():
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
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] fansi_0.4.2 assertthat_0.2.1 utf8_1.2.1 crayon_1.5.1 dplyr_1.0.8 R6_2.5.1
[7] DBI_1.1.2 lifecycle_1.0.1 magrittr_2.0.1 pillar_1.7.0 rlang_1.0.2 cli_3.2.0
[13] rstudioapi_0.13 remotes_2.4.2 vctrs_0.3.8 generics_0.1.2 ellipsis_0.3.2 tools_4.1.0
[19] glue_1.4.2 purrr_0.3.4 xfun_0.30 compiler_4.1.0 pkgconfig_2.0.3 knitr_1.39
[25] tidyselect_1.1.2 tibble_3.1.2
and for rstudioapi::getVersion()
> rstudioapi::getVersion()
[1] ‘1.4.1106’
On Windows 10, I am getting the following error with blogdown::new_site() function:
Hugo has been installed to "C:\Users\hp\AppData\Roaming\Hugo\0.89.4".
You are recommended to set options(blogdown.hugo.version = "0.89.4")
in the .Rprofile file in your website project. See the blogdown book
for more info on .Rprofile:
https://bookdown.org/yihui/blogdown/global-options.html
Error: 'system3' is not an exported object from 'namespace:xfun'
I'm wondering what am I missing here? Any hints.
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] 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] xfun_0.28
loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2 blogdown_1.6.5 pacman_0.5.1
I don't know how you managed to install the dev version of blogdown without installing the dev version of xfun at the same time, since the latter is required (as specified in DESCRIPTION). Per installation instruction in README, this is how you install the dev version of blogdown:
remotes::install_github('rstudio/blogdown')
And the dev version of xfun should be installed automatically (note that you will need RTools).
FYI I get the exact same error trying to following the TL;DR section of this blog and that is after explicitly updating the xfun package. Here is the entire code segment I am trying to run:
remotes::install_github("rstudio/blogdown")
usethis::create_project()
blogdown::new_site(theme = "wowchemy/starter-academic")
and here is the error I am getting:
09:14:26 > blogdown::new_site(theme = "wowchemy/starter-academic")
― Creating your new site
| Installing Hugo
The latest Hugo version is v0.90.1
trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.90.1/hugo_extended_0.90.1_macOS-ARM64.tar.gz'
Content type 'application/octet-stream' length 16102460 bytes (15.4 MB)
==================================================
downloaded 15.4 MB
Hugo has been installed to "/Users/rogerbos/Library/Application Support/Hugo/0.90.1".
Error: 'system3' is not an exported object from 'namespace:xfun'
09:14:26 >
and here is my sessionInfo():
9:14:26 > sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.0.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/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] datasets utils stats graphics grDevices methods base
other attached packages:
[1] alphavantager_0.1.2 googlesheets4_1.0.0 googledrive_2.0.0
[4] clipr_0.7.1 jsonlite_1.7.2 stringi_1.7.6
[7] dtplyr_1.1.0 data.table_1.14.2 dplyr_1.0.7
[10] plyr_1.8.6 testthat_3.1.0 lubridate_1.8.0
[13] timeDate_3043.102 sendmailR_1.2-1 rmarkdown_2.11
[16] devtools_2.4.2 usethis_2.1.3 xts_0.12.1
[19] zoo_1.8-9 MASS_7.3-54 fortunes_1.5-4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 lattice_0.20-45 prettyunits_1.1.1
[4] ps_1.6.0 assertthat_0.2.1 rprojroot_2.0.2
[7] digest_0.6.29 utf8_1.2.2 R6_2.5.1
[10] cellranger_1.1.0 evaluate_0.14 blogdown_1.6.5
[13] httr_1.4.2 pillar_1.6.4 rlang_0.4.12
[16] curl_4.3.2 rstudioapi_0.13 callr_3.7.0
[19] desc_1.4.0 compiler_4.1.2 xfun_0.28
[22] pkgconfig_2.0.3 askpass_1.1 base64enc_0.1-3
[25] pkgbuild_1.2.0 htmltools_0.5.2 openssl_1.4.5
[28] tidyselect_1.1.1 tibble_3.1.5 bookdown_0.24
[31] fansi_0.5.0 crayon_1.4.2 withr_2.4.2
[34] rappdirs_0.3.3 grid_4.1.2 lifecycle_1.0.1
[37] DBI_1.1.1 magrittr_2.0.1 cli_3.1.0
[40] cachem_1.0.6 fs_1.5.0 remotes_2.4.1
[43] ellipsis_0.3.2 vctrs_0.3.8 generics_0.1.1
[46] tools_4.1.2 glue_1.5.1 purrr_0.3.4
[49] processx_3.5.2 pkgload_1.2.3 fastmap_1.1.0
[52] gargle_1.2.0 sessioninfo_1.2.1 memoise_2.0.0
[55] knitr_1.36
I am writing a shiny app on my local computer (ISO-8859-1 is system default encoding). When I save ui.R with this encoding and I try to run the app an error related to non-UTF-8 encoding creeps up. So, I save the file with UTF-8 encoding and the app works if I don't have special characters in the file.
The special characters are mexican accents (á, é, í, ó) which supposedly are supported by UTF-8.
If I save the file with UTF-8 and open it again, I get these characters translated into rubbish (?A, etc).
I'm not sure what I am missing.
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
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] broom_0.4.1 knitr_1.15.1 data.table_1.10.0 reshape2_1.4.2 RODBC_1.3-14 tse.sql_0.1.0
[7] memisc_0.99.7-1 MASS_7.3-45 lattice_0.20-34 foreign_0.8-67 magrittr_1.5 ggplot2_2.2.1
[13] inegiR_1.2.0 dplyr_0.5.0 tse.utils_0.1.0 shiny_0.14.2
loaded via a namespace (and not attached):
[1] zoo_1.7-13 splines_3.3.2 colorspace_1.2-7 sourcetools_0.1.5 htmltools_0.3.5 yaml_2.1.14
[7] mgcv_1.8-15 base64enc_0.1-3 XML_3.98-1.5 nloptr_1.0.4 DBI_0.5-1 plyr_1.8.4
[13] stringr_1.1.0 MatrixModels_0.4-1 munsell_0.4.3 gtable_0.2.0 psych_1.6.9 evaluate_0.10
[19] SparseM_1.74 httpuv_1.3.3 quantreg_5.29 pbkrtest_0.4-6 parallel_3.3.2 Rcpp_0.12.7
[25] xtable_1.8-2 scales_0.4.1 backports_1.0.4 jsonlite_1.2 mime_0.5 lme4_1.1-12
[31] mnormt_1.5-5 digest_0.6.10 stringi_1.1.2 grid_3.3.2 rprojroot_1.1 tools_3.3.2
[37] lazyeval_0.2.0 tibble_1.2 tidyr_0.6.0 car_2.1-4 Matrix_1.2-7.1 assertthat_0.1
[43] minqa_1.2.4 rmarkdown_1.3 R6_2.2.0 nnet_7.3-12 nlme_3.1-128
Thanks to a comment: (https://stackoverflow.com/users/4395383/ujjwal-kumar). Seems like an rstudio thing, just tried reopening with another encoding...