博文

目前显示的是 一月, 2019的博文

windows 安装 ROracle

环境变量 系统变量 OCI_LIB64=C:\instantclient_19_10 OCI_INC=C:\instantclient_19_10\sdk\include ORACLE_HOME=C:\instantclient_19_10 用户变量 PATH=C:\Program Files\R\R-4.0.5\bin\x64;C:\instantclient_19_10 下载ROracle_1.3-2.tar.gz 用Rstudio 在本地进行安装。

R interface to Keras

sudo proxychains pip3 install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0-cp36-cp36m-linux_x86_64.whl https://tensorflow.rstudio.com/keras/

purrr 循环

df1 <- as.data.frame(df[,4:21]) statistic <- matrix(0, nrow = 3, ncol = 15,                     dimnames = list(names(df1[1:3]),names(df1[4:18]))) p <- matrix(0, nrow = 3, ncol = 15,             dimnames = list(names(df1[1:3]),names(df1[4:18]))) for (i in seq(1,3)) {   for (j in seq(4,18)) {     statistic[i,j-3] <- gmodels::CrossTable(df1[,i],df1[,j],chisq = T)$chisq$statistic     p[i,j-3] <- gmodels::CrossTable(df1[,i],df1[,j],chisq = T)$chisq$p.value   } } p %<>%as.tibble(p) item <- function(col){   col <- map_dbl(col, function(x){if(x<0.05){x=0.05} else{x=round(x,2)}}) } p %<>% map_df(function(x){x=item(x)}) statistic %<>%as.tibble(statistic) item <- function(col){   col <- map_dbl(col, function(x){x=round(x,2)}) } statistic %<>% map_df(function(x){x=item(x)})

循环T Wilcoxon检验

x <- c(20.99,20.41,20.10,20.00,20.91,22.60,20.99,20.42,20.90,22.99,23.12,20.89) #判断数据是否服从某一分布 library(fitdistrplus) descdist(x) fitdist(x,"norm") fitdist(x,'unif') fitdist(x, "gamma") fitdist(x, "exp") # 正态性检验 shapiro.test(x) #ks.test(x,"pnorm",mean(x),sd(x)) #T检验 #t.test(x, mu = 20.7 ) statistic <- c() p <- c() for (i in seq(1,length(x))) {   statistic[i] <- t.test(x[-i],mu=x[i])$statistic   p[i] <- t.test(x[-i],mu=x[i])$p.value } #Wilcoxon 符号秩检验 statistic <- c() p <- c() for (i in seq(1,length(x))) {   statistic[i] <- wilcox.test(x[-i],mu=x[i])$statistic   p[i] <- wilcox.test(x[-i],mu=x[i])$p.value }

R and Python with Rstudio

R Notebook ```{r} library(reticulate) use_python("/usr/bin/python") data(mtcars) head(mtcars) ``` ```{python} import numpy import pandas print(numpy.pi) print(type(r.mtcars)) print(pandas.DataFrame.describe(r.mtcars)) print(r.mtcars.describe()) ```