-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4a-python-setup.Rmd
More file actions
58 lines (42 loc) · 1.34 KB
/
4a-python-setup.Rmd
File metadata and controls
58 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: "Python Setup"
subtitle: "Analytics Sandbox"
author: "K. Bret Staudt Willet | Florida State University"
date: "February 14, 2023"
---
```{r setup, message=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(reticulate)
```
## Set Up Python to Use in R
For help installing Python to your local machine, see:
https://docs.python-guide.org/
See also:
https://support.posit.co/hc/en-us/articles/1500007929061-Using-Python-with-the-RStudio-IDE
```{r python-install, eval=FALSE}
reticulate::install_miniconda()
```
## Create a New Python Environment
```{r new_python_env, eval=FALSE}
#reticulate::conda_create("~/r-reticulate")
```
## Check Python Installation
```{r check-install, eval=FALSE}
use_python('~/r-reticulate/bin/python3')
py_config()
```
## Install Python Packages
```{r install_python_packages, eval=FALSE}
# General Python packages:
conda_install("~/r-reticulate", "pandas")
conda_install("~/r-reticulate", "scipy")
conda_install("~/r-reticulate", "seaborn")
#conda_install("~/r-reticulate", "datetime") # install with command line $: pip3 install datetime
# Packages for Reddit:
conda_install("~/r-reticulate", "praw")
#conda_install("~/r-reticulate", "pmaw") # install with command line $: pip3 install pmaw
```
## Indicate Specific Conda Environment
```{r set_python_env, eval=FALSE}
reticulate::use_condaenv("~/r-reticulate")
```