You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/01-R_PythonSetup.Rmd
+7-10Lines changed: 7 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ This R Markdown file corresponds to data analysis for a **Developmental Cognitiv
8
8
9
9
This tutorial shows how to access Python in R Studio via the *reticulate* package (Ushey et al., 2020). While there are multiple ways in which a user may call Python from R (e.g., **repl_python()** function), our discussion focuses solely on how to access Python in an R Markdown file. Please see the [*reticulate* website](https://rstudio.github.io/reticulate) for details on alternative approaches. We also recommend reviewing the [reticulate cheat sheet](https://ugoproto.github.io/ugo_r_doc/pdf/reticulate.pdf) provided by R Studio.
10
10
11
-
## **1.** Install packages
11
+
12
12
### Load reticulate
13
13
```{r}
14
14
#install.packages("reticulate")
@@ -27,15 +27,14 @@ Several Python (and conda) versions may already exist on your computer. It is th
27
27
Sys.which("python")
28
28
```
29
29
30
-
## **2.** Identify and set python
31
30
### Return all detected python versions
32
31
```{r}
33
32
py_discover_config()
34
33
```
35
34
36
35
### List all available conda environments
37
36
```{r}
38
-
conda_list(conda= "auto")
37
+
conda_list(conda= "auto")
39
38
```
40
39
41
40
### Set python version
@@ -50,14 +49,12 @@ usethis::edit_r_profile()
50
49
use_virtualenv("r-reticulate")
51
50
```
52
51
53
-
54
-
## **3.** Load python packages
55
52
### Install packages
56
53
Uncomment this code when you are ready to install python packages.
It can be useful to plot frequency-by-frequency error of the model fit, to identify where in frequency space the spectrum is (or is not) being fit well. When fitting individual spectrum, this can be accomplished using the `compute_pointwise_error_fm` function.
192
203
193
-
In this case, we can see that error fluctuates around 0.05, which is the same as the mean absolute error for the model (MAE). There are points in the spectrum where the model fit is somewhat poor, particularly < 4 Hz, ~6-9 Hz, and ~14 Hz. Further considerations may be necessary for this model fit.
In this case, we can see that error fluctuates around 0.06, which is the mean absolute error for the model (MAE). There are points in the spectrum where the model fit is somewhat poor, particularly < 4 Hz, ~6-9 Hz, and ~14 Hz. Further considerations may be necessary for this model fit.
0 commit comments