From 4a92c87350006ac28c09c33712a7c8af1a967810 Mon Sep 17 00:00:00 2001 From: Kyle Barrett Date: Thu, 8 Feb 2024 13:05:05 -0500 Subject: [PATCH] Built site for pythonR: 0.0.1@ --- articles/getting-started.html | 45 +++++++++++++++++++++++++++++------ index.html | 23 ++++++++++++++++-- pkgdown.yml | 2 +- 3 files changed, 60 insertions(+), 10 deletions(-) diff --git a/articles/getting-started.html b/articles/getting-started.html index ad83a20..69610e9 100644 --- a/articles/getting-started.html +++ b/articles/getting-started.html @@ -97,14 +97,15 @@

Kyle +

Setting up your environment

You begin by setting up a python environment (conda or virtual) with the required imports you will need:

-
-library(pythonR)
-
+
+
 ## With a conda environment (the default) ##
 py_env <- setup_py_env(py_pkgs = c("pandas", "numpy", "scipy"))
 py_env
@@ -129,7 +130,7 @@ 

Setting up your environmentshutdown_virtual_env(py_env$env_name)

Note that you can always install packages to the environment you created at a later time:

-
+
 # Installing a package after setup (works with both environment types)
 py_env <- pythonR::setup_py_env(py_pkgs = c("pandas", "numpy"))
 pythonR::install_py_pkgs(py_pkgs = c('scipy'), env_name = py_env$env_name)
@@ -142,7 +143,7 @@ 

Setting up your environmentpythonR::check_py_pkgs_installed(required_py_pkgs)

-

Create a python function +

Create a python-based function

Additional helper functions are provided for ensuring required python packages are installed or importing them at various stages within an R @@ -151,7 +152,7 @@

Create a python function -
+
-
+
+

Provided python-based functions +

+

pythonR comes with some example functions you can +reference when developing your own:

+
+# Get list of available examples.
+ls(pythonR_examples)
+#> [1] "py_add"        "py_array"      "py_check_path"
+
+# View the functions
+get("py_add", envir = pythonR_examples)
+#> expression({
+#>     py_add <- function(x = 5, y = 10) {
+#>         py_script <- file.path(EXAMPLE_PYTHON_DIR, "script-add.py")
+#>         if (isTRUE(python_is_installed())) {
+#>             reticulate::source_python(py_script)
+#>         }
+#>         sum <- py_add(x, y)
+#>         return(sum)
+#>     }
+#> })
+# get("py_check_path", envir = pythonR_examples)
+# get("py_array", envir = pythonR_examples)
+
+# Assign the function to use it
+py_add <- get_py_example("py_add")
+py_add(3, 4)
+#> [1] 7
diff --git a/index.html b/index.html index c027174..5ca3f30 100644 --- a/index.html +++ b/index.html @@ -88,11 +88,30 @@ -

pythonR includes helper functions for using Python in R. It is essentially a wrapper of the reticulate R package, and can helpful in an R package development or project environment where you want more readable code for setting up a python environment and installing any necessary python dependencies.

-

Install the latest development version:

+

pythonR is an R package that facilitates the seamless integration of Python code and functionality within R environments. Leveraging the reticulate package, pythonR aims to simplify the process of developing Python-based functions in R, making it easier to set up, test, and validate Python code directly within the R environment.

+
+

Features +

+
    +
  • Provides a convenient wrapper for using Python in R, reducing the overhead of managing Python environments.
  • +
  • Simplifies the installation and management of required Python packages from within R.
  • +
  • Offers functions for importing Python modules and executing Python code directly from R scripts or functions.
  • +
  • Exports example python-based functions
  • +
+
+
+

Getting Started +

+

Install the latest development version from GitHub:

 devtools::install_github("barrettk/pythonR")

See the Getting Started vignette for more details.

+
+

Contribution +

+

Contributions to pythonR are welcome! If you encounter any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request on the GitHub repository.

+
+

diff --git a/pkgdown.yml b/pkgdown.yml index 788ffe7..a2b4762 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: getting-started: getting-started.html -last_built: 2024-02-08T03:52Z +last_built: 2024-02-08T18:04Z urls: reference: https://barrettk.github.io/pythonR/reference article: https://barrettk.github.io/pythonR/articles