コード入りの投稿サンプル

news
code
analysis
R
Python
Author

Nobukuni Hyakutake

Published

2023-01-25

This is a post with executable code.

1 R-1

library(reticulate)
library(knitr)
library(tidyverse)
a<-runif(3)
a<-round(a,2)
print(a)
[1] 0.02 0.51 0.00
b<-"Hello, "

2 Python

import numpy as np
c="World!"
d=r.b+c
print(d)
Hello, World!
e=np.sin(1.5)*12

3 R-2

f<-py$e/3
print(f)
[1] 3.98998

4 変数をループで解析して出す

analy_titlle <- c("analy_a", "analy_b", "analy_c")

for(i in 1:length(analy_titlle)){
  cat(paste("\n##",  analy_titlle[i], "\n"))
  
  cat(str_c("i= ",i, "\n"))
  
  hist(rnorm(100,mean = i*3))
  
  cat("\n")
}

4.1 analy_a

i= 1 ::: {.cell-output-display} :::

4.2 analy_b

i= 2 ::: {.cell-output-display} :::

4.3 analy_c

i= 3 ::: {.cell-output-display} :::

5 R version

R.version.string
[1] "R version 4.2.2 (2022-10-31)"

6 Python version

import platform
"Python version "+platform.python_version()
'Python version 3.10.7'

7 Citation

  • R Core Team (2022). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/