= 10
x = x + 5
y print(y)
15
mamba create -n ml7331 python=3.9 r-base=4.4.1
mamba activate ml7331
mamba install ipykernel
python -m ipykernel install --user --name ml7331 --display-name "Python (ml7331)"
# (restart vscode or source ~/.bashrc)
mamba activate ml7331
pip install rpy2
mamba install notebook
mamba install tzlocal
mamba install plotly
pip install matplotlib
pip install scipy
pip install scikit-learn
pip install pillow
pip install tensorflow
pip check
.libPaths(c("C:/Users/jessi/mambaforge/envs/ml7331/Lib/R/library", .libPaths()))
install.packages("reticulate")
install.packages('arules')
install.packages('arulesViz')
install.packages('mlbench')
library(arules)
library(arulesViz)
library(mlbench)
library(reticulate)
mamba env export -n ml7331 > ml7331_environment.yml
conda clean --all
library(reticulate)
use_condaenv("ml7331", required= TRUE)
py_run_string("x = 10")
py_run_string("y = x + 5")
$x # Access the Python variable in R
py$y # Access another Python variable in R py
system("mamba install -c conda-forge r-ggplot2")
system("mamba install -c conda-forge numpy")
# Install numpy using pip
py_install("numpy", method = "pip")
<- import("tensorflow")
tensorflow print(tensorflow$__version__)
<- import("torch")
torch print(torch$__version__)
<- import("keras")
keras print(keras$__version__)
system("mamba list")
system("pip list")
= 10
x = x + 5
y print(y)
15
rpy2
is used to run R within Python. (install with pip)reticulate
is used to run Python within R (install within R). ```