From b1a48717e2f0c2dee8ade733f8dde544c9a403a8 Mon Sep 17 00:00:00 2001 From: patrickbarks Date: Thu, 5 Oct 2023 15:25:23 +0200 Subject: [PATCH] omit readme console output and add link --- README.Rmd | 15 ++++++++++----- README.md | 32 +++++++------------------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/README.Rmd b/README.Rmd index 3e4e972..3f1d59d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -40,12 +40,17 @@ reticulate::py_available(initialize = TRUE) If you don't already have Python installed, it can be downloaded from www.python.org/downloads, or installed directly from R using the -`install_python()` function in reticulate. +`install_python()` function in reticulate. See also [Using Python with the +RStudio +IDE](https://support.posit.co/hc/en-us/articles/1500007929061-Using-Python-with-the-RStudio-IDE) +for more information on configuring RStudio to use Python. ```{r, eval=FALSE} reticulate::install_python() ``` + + Finally, use the `rpxl::install_rpxl()` function to install the required Python dependencies. @@ -66,7 +71,7 @@ Read password-protected .xlsx files with function `rp_xlsx()`, a wrapper to ```{r} path_xlsx <- system.file("extdata", "xltest.xlsx", package = "rpxl") -rp_xlsx(path_xlsx, password = "1234") +df <- rp_xlsx(path_xlsx, password = "1234") ``` Read password-protected .xlsb files with function `rp_xlsb()`, a wrapper to @@ -77,7 +82,7 @@ sheet 1. ```{r} path_xlsb <- system.file("extdata", "xltest.xlsb", package = "rpxl") -rp_xlsb(path_xlsb, password = "1234", sheet = 1) +df <- rp_xlsb(path_xlsb, password = "1234", sheet = 1) ``` To decrypt a password-protected Excel file and save it under a different @@ -93,14 +98,14 @@ path_decrypted <- decrypt_wb(path_xlsx, password = "1234") The decrypted file can then be read into R in a separate step. ```{r} -readxl::read_xlsx(path_decrypted) +df <- readxl::read_xlsx(path_decrypted) ``` You may want to explicitly delete the decrypted file afterwards, if its contents are sensitive. Otherwise, if it's a temporary file created with `tempfile()`, it will be automatically deleted when the current R session is closed. -```{r} +```{r, eval=FALSE} file.remove(path_decrypted) ``` diff --git a/README.md b/README.md index e7e0b95..255b533 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,10 @@ reticulate::py_available(initialize = TRUE) If you don’t already have Python installed, it can be downloaded from www.python.org/downloads, or installed directly from R using the -`install_python()` function in reticulate. +`install_python()` function in reticulate. See also [Using Python with +the RStudio +IDE](https://support.posit.co/hc/en-us/articles/1500007929061-Using-Python-with-the-RStudio-IDE) +for more information on configuring RStudio to use Python. ``` r reticulate::install_python() @@ -63,16 +66,9 @@ to `read_xlsx()` in the [readxl](https://readxl.tidyverse.org/) package. ``` r path_xlsx <- system.file("extdata", "xltest.xlsx", package = "rpxl") -rp_xlsx(path_xlsx, password = "1234") +df <- rp_xlsx(path_xlsx, password = "1234") ``` - ## # A tibble: 3 × 3 - ## x ext protected - ## - ## 1 1 xlsx yes - ## 2 2 xlsx yes - ## 3 3 xlsx yes - Read password-protected .xlsb files with function `rp_xlsb()`, a wrapper to `read_xlsb()` in the [readxlsb](https://github.com/velofrog/readxlsb) package. Note that `read_xlsb()` requires the worksheet to be explicitly @@ -81,14 +77,9 @@ specified (either with argument ‘sheet’ or ‘range’), whereas ``` r path_xlsb <- system.file("extdata", "xltest.xlsb", package = "rpxl") -rp_xlsb(path_xlsb, password = "1234", sheet = 1) +df <- rp_xlsb(path_xlsb, password = "1234", sheet = 1) ``` - ## x ext protected - ## 1 1 xlsb yes - ## 2 2 xlsb yes - ## 3 3 xlsb yes - To decrypt a password-protected Excel file and save it under a different filename (without immediately reading it into R), you can use the function `decrypt_wb()`. The function returns the path to the decrypted @@ -102,16 +93,9 @@ path_decrypted <- decrypt_wb(path_xlsx, password = "1234") The decrypted file can then be read into R in a separate step. ``` r -readxl::read_xlsx(path_decrypted) +df <- readxl::read_xlsx(path_decrypted) ``` - ## # A tibble: 3 × 3 - ## x ext protected - ## - ## 1 1 xlsx yes - ## 2 2 xlsx yes - ## 3 3 xlsx yes - You may want to explicitly delete the decrypted file afterwards, if its contents are sensitive. Otherwise, if it’s a temporary file created with `tempfile()`, it will be automatically deleted when the current R @@ -120,5 +104,3 @@ session is closed. ``` r file.remove(path_decrypted) ``` - - ## [1] TRUE