1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

初めての R と beeswarm  と 無料版 rstudio ( ubuntu からはじめて arcolinux へ)

Last updated at Posted at 2020-02-24
1 / 3

初めてなので間違ってるかもです

その場合は ご指摘ください

1.png

無料版rstudioです
2.png

https://cran.r-project.org/bin/linux/ubuntu/README.html
にて
インストします

なお

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu disco-cran35/'

sudo apt install r-base

でした

あとは

$ sudo -i R

> x = c(0 ,0 ,1,以下略 )
> y = c(1.72 ,1.54 ,3.30,以下略 )

> install.packages("beeswarm", dependencies = TRUE)
 
> beeswarm(list(x, y), method = "swarm", pch = 1, main = "swarm")

但し
beeswarm(list(x, y), method = "swarm", pch = 1, main = "swarm")
 beeswarm(list(x, y), method = "swarm", pch = 1, main = "swarm") でエラー: 
   関数 "beeswarm" を見つけることができませんでした

となるときは
http://bigvalley.hatenablog.com/entry/2015/12/09/090437
の

library(beeswarm)

とすればbeeswarm関数が使えるようになる。

working directory の変更
データはhttp://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html を利用

> getwd()
[1] "/root"
> setwd("/home/jp/R---")
> getwd()
[1] "/home/jp/R---"
> ( x <- read.table("data01.txt") )
  V1  V2 V3
1  F 158 51
2  F 162 55
3  M 177 72
4  M 173 57
5  M 166 64

excelファイルからは https://sites.google.com/site/webtextofr/data の

library(gdata)
data3=read.xls(“demodata.xls”)
かな?(未確認)

役立つだろうスクリプト
cat sed.bat 
cat $1 | sed "s/\"/ /g" > X.txt 
cat X.txt | sed -e 's/  */ /g' 


これを利用して
# R
>getwd() 現在のワーキングディレクトリの表示
> setwd("/home/jp/R---")  ワーキングディレクトリを/home/jp/R---にする
> x <- read.table("1.csv") データをxに読み込む
> x データの表示
> install.packages("beeswarm", dependencies = TRUE)  beeswarmを扱うパッケージの導入
> library(beeswarm) beeswarmを扱うパッケージの足らない部分の強化
> boxplot(x)  ひげ図を書く
> beeswarm(x,add=TRUE)  ひげ図の上のbeeswarmを加える

rstudioについては 本来は以下だけど

https://rstudio.com/products/rstudio/download-server/debian-ubuntu/
によると
Install for Debian 10 / Ubuntu 18
To download and install RStudio Server open a terminal window and execute the following commands.
Size:  38.41 MB | SHA-256: 62b1fb2f | Version:  1.2.5033| Released:  2019-12-17

sudo apt-get install gdebi-core
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.5033-amd64.deb
sudo gdebi rstudio-server-1.2.5033-amd64.deb

これよりか以下でOK

https://rstudio.com/products/rstudio/download/#download より

Ubuntu 18/Debian 10の
	 rstudio-1.2.5033-amd64.deb 
をダウンロードして

apt install gdebi
gdebi rstudio-1.2.5033-amd64.deb

R と rstudioがあります
1.png

講義が聞けます

https://www.youtube.com/watch?v=6b8pFctsBog&list=TLPQMjgwMjIwMjB-dt37QZwnoQ&index=24
とかyoutubeに一杯ありますねー

windows10用もありますね

0.jpg

1.jpg

3.jpg


archlinux では

pacman -S r tk

rstudioは  yay -Sy rstudio-desktop-git
ソ-スからからcc1plusで作って
1.png

解説は
https://wiki.archlinux.jp/index.php/R

なお
https://datumstudio.jp/blog/r%E3%81%A7excel%EF%BC%88xlsx%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%EF%BC%89%E3%82%92%E8%AA%AD%E3%81%BF%E8%BE%BC%E3%82%80
を参考にすると

# R
> getwd()
[1] "/home/nvme/R---"
> install.packages('openxlsx')
> library(openxlsx)
> X <- read.xlsx("Beeswarm.xlsx")
> install.packages("beeswarm", dependencies = TRUE)
> library(beeswarm)
> boxplot(X)
> beeswarm(X,add=TRUE)
> q()

なおBeeswarm.xlsxは
1.png

一旦 作ってしまえば

> search()
[1] ".GlobalEnv"        "package:stats"     "package:graphics" 
[4] "package:grDevices" "package:utils"     "package:datasets" 
[7] "package:methods"   "Autoloads"         "package:base"     
> library(openxlsx)
> library(beeswarm)
> search()
 [1] ".GlobalEnv"        "package:beeswarm"  "package:openxlsx" 
 [4] "package:stats"     "package:graphics"  "package:grDevices"
 [7] "package:utils"     "package:datasets"  "package:methods"  
[10] "Autoloads"         "package:base"     
> 

と "package:beeswarm" "package:openxlsx" がコンパイルしなくてもいけます。
よかったね

# pacman -S yay

$ yay -S pip
$ pip install numpy --no-warn-script-location
$ pip install pandas
$ pip install scipy
$ pip install matplotlib

https://www.qoosky.io/techs/9ca9c78897 参考にしました

これにて例えば以下です
1.jpg

付録1)良いページ

https://oku.edu.mie-u.ac.jp/~okumura/stat/first.html
https://www1.doshisha.ac.jp/~mjin/R/

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?