博文

目前显示的是 七月, 2016的博文

How to load the {rJava} package after the error "JAVA_HOME cannot be determined from the Registry"

1、 下载jdk https://github.com/ojdkbuild/ojdkbuild 2、 Sys.setenv(JAVA_HOME='F:\\java-1.8.0-openjdk-1.8.0.101-1-ojdkbuild.b13.windows.x86_64\\jre') library(rJava)

openjre 8 安装

sudo apt-get install openjdk-8-jre  openjdk-8-jdk sudo ln -s /usr/lib/jvm/java-8-openjdk-amd64/ /usr/lib/jvm/default-java

openjre 8 安装

sudo apt-get install openjdk-8-jre  openjdk-8-jdk sudo ln -s /usr/lib/jvm/java-8-openjdk-amd64/ /usr/lib/jvm/default-java

MXnet在Linux下安装

1.sudo apt-get install -y build-essential git libblas-dev libopencv-dev libv8-dev librsvg2-dev libfftw3-dev libatlas-base-dev 2.git clone --recursive https://github.com/dmlc/mxnet 3.cd mxnet   make -j4 4.Rscript -e "install.packages('devtools', repo = 'https://cran.rstudio.com')" cd R-package Rscript -e "library(devtools); library(methods); options(repos=c(CRAN='https://cran.rstudio.com')); install_deps(dependencies = TRUE)" cd .. make rpkg R CMD INSTALL mxnet_0.7.tar.gz 参考:http://lchiffon.github.io/2015/11/06/install.html 错误Error in dyn.load(file, DLLpath = DLLpath, ...) :   unable to load shared object '/home/xuefliang/R/x86_64-pc-linux-gnu-library/3.3/stringi/libs/stringi.so':   libicui18n.so.52: cannot open shared object file: No such file or directory 解决:重新安装stringi包

TensorFlow安装配置

# Ubuntu/Linux 64-bit, CPU only, Python 2.7: $ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl # Ubuntu/Linux 64-bit, GPU enabled, Python 2.7. Requires CUDA toolkit 7.5 and CuDNN v4. # For other versions, see "Install from sources" below. $ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

anaconda2/lib/libreadline.so.6: undefined symbol: PC 错误处理

1、删除anaconda2/lib下 libreadline.a  libreadline.so.6.2 libreadline.so.6 libreadlin.so 2、pip install readline 参考 https://github.com/ContinuumIO/anaconda-issues/issues/42 jupyter notebook 中使用R import rpy2 %load_ext rpy2.ipython %%R 本cell中为R语言 %R 本行中为R语言

Jupyter里面运行R

1、conda install -c r r-essentials or conda create -n my-r-env -c r r-essentials 2、建立一个~/Rnotebooks目录,进入后执行 source activate my-r-env jupyter notebook

windows 安装 rpy2

1、下载rpy2 http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2, 2、pip install C:\Users\xuefliang\Downloads\rpy2-2.7.8-cp27-none-win_amd64.whl 3、 环境变量 path:C:\Program Files\R\R-3.3.0\bin R_Home: C:\Program Files\R\R-3.3.0 R_User: C:\Program Files\R\R-3.3.0\bin

tidyr学习

## 为方便处理,在数据集中增加一列car ```{r echo=FALSE,warning=FALSE,error=FALSE} library(tidyr) library(dplyr) library(tibble) head(mtcars) mtcars$car <- rownames(mtcars) mtcars <- mtcars[, c(12, 1:11)] ``` ##gather-宽数据转为长数据,类似于reshape2包中的melt函数 ```{r} mtcarsNew <- mtcars%>%gather(attribute,value,-car) #tidyr很好的一点是可以只gather若干列而其他列保持不变。如果你想gather在map和gear之间的所有列而保持carb和car列不变 mtcarsNew <- mtcars%>%gather(attribute,value,mpg:gear) ``` ##spread—长数据转为宽数据,类似于reshape2包中的cast函数 ```{r} mtcarsSpread <- mtcarsNew%>%spread(attribute,value) ``` ##unit—多列合并为一列 ```{r} set.seed(1) date <- as.Date('2016-01-01') + 0:14 hour <- sample(1:24, 15) min <- sample(1:60, 15) second <- sample(1:60, 15) event <- sample(letters, 15) data <- data.frame(date, hour, min, second, event) dataNew <- data%>%   unite(datehour,date,hour,sep=' ')%>%   unite(datetime,datehour,min,second,sep=':') ``` ##separate—将一列分离为多列 ```{r}