Skip to content

Commit

Permalink
omit readme console output and add link
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbarks committed Oct 5, 2023
1 parent 4ca56c5 commit b1a4871
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
15 changes: 10 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
```

32 changes: 7 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
## <dbl> <chr> <chr>
## 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
Expand All @@ -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
Expand All @@ -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
## <dbl> <chr> <chr>
## 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
Expand All @@ -120,5 +104,3 @@ session is closed.
``` r
file.remove(path_decrypted)
```

## [1] TRUE

0 comments on commit b1a4871

Please sign in to comment.