library(tidyverse)
## ── Attaching packages ────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.2.1 ✓ purrr 0.3.3
## ✓ tibble 2.1.3 ✓ dplyr 0.8.3
## ✓ tidyr 1.0.0 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.4.0
## ── Conflicts ───────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(reticulate)
# conda_list()
use_condaenv("anaconda3")
py_config()
## python: /Users/jrosenb8/anaconda3/bin/python
## libpython: /Users/jrosenb8/anaconda3/lib/libpython3.7m.dylib
## pythonhome: /Users/jrosenb8/anaconda3:/Users/jrosenb8/anaconda3
## version: 3.7.3 (default, Mar 27 2019, 16:54:48) [Clang 4.0.1 (tags/RELEASE_401/final)]
## numpy: /Users/jrosenb8/anaconda3/lib/python3.7/site-packages/numpy
## numpy_version: 1.16.4
##
## python versions found:
## /Users/jrosenb8/anaconda3/bin/python
## /Users/jrosenb8/anaconda3/envs/r-reticulate/bin/python
## /usr/bin/python
## /usr/bin/python3
## /usr/local/bin/python3
josh = c(1, 11, 22, 33, 44, 55, 66, 77)
josh
## [1] 1 11 22 33 44 55 66 77
Plist = [11, 22, 33, 44, 55, 66]
print(Plist)
## [11, 22, 33, 44, 55, 66]
def Psq_fun (x):
value= x*x
return(value)
print(Psq_fun(9))
## 81
py$Psq_fun(9)
## [1] 81
l = [1, 2, 3]
print(l)
## [1, 2, 3]
def my_function():
print('hello from a function')
my_function()
## hello from a function
import numpy as np
a = np.arange(15).reshape(3, 5)
print(a)
## [[ 0 1 2 3 4]
## [ 5 6 7 8 9]
## [10 11 12 13 14]]
a
## array([[ 0, 1, 2, 3, 4],
## [ 5, 6, 7, 8, 9],
## [10, 11, 12, 13, 14]])