手机安装 R-base

2022-04-08 00:00:00 专区 订阅 付费 图片 安装

参考网络资料,折腾手机安装R,再总结下。


首先安装 F-droid,从这里安装termux 和 termux:api


完成安装后,输入以下命令切换源

termux-change-repo

注意:是用空格 表示选中 某一项,上图选择清华源。


termux-setup-storage


安装SSH服务,sshd 启动ssh服务,passwd 修改密码,端口是8022

pkg install openssh


ifconfig 查ip, 笔记本通过 手机热点连上:这里显示termux IP 是 192.168.92.246

照跑以下命令

pkg install openssh curl gnupg wget vim openssh boost boost-static python mpv make libtiff libcairo librsvg clang openssl libcurl libicu libxml2 sox
wget https://its-pointless.github.io/setup-pointless-repo.sh
chmod +x setup-pointless-repo.sh
bash setup-pointless-repo.sh
pkg install libgomp-10 gcc-10 libgfortran5
termux-setupgcc-10
termux-setupclang-gfort-10
pkg install r-base
pkg install r-cran*
pkg install termux*


恭喜成功安装 python 和R 环境了。接着安装一些R包


options(repos=structure(c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")))
install.packages("zoo")
packagelist<-unique(c("ggplot2","tidyverse","stringr","TTR","quantmod","magrittr","lubridate","whereami","dplyr","whereami","reticulate","data.table","sqldf","stringr","httr","rvest"))

for (i in 1:length(packagelist)){
if ( packagelist[i] %in% rownames(installed.packages())==FALSE){ print("=============================================") print(paste(packagelist[i],'Planning install!!!!')) print("=============================================") Sys.sleep(2.5)
install.packages(packagelist[i])
} else { print("=============================================") print(paste(packagelist[i],' installed.ok')) print("=============================================") Sys.sleep(2.5) }
}


端午快乐!


参考链接:


https://conr.ca/post/installing-r-on-android-via-termux/

https://www.bilibili.com/read/cv3804689/

https://github.com/its-pointless

https://github.com/termux/

https://mirrors.tuna.tsinghua.edu.cn/help/termux/

相关文章