0
0

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でコンマなしdatファイルをcsvファイルに変換する

Last updated at Posted at 2020-10-03

【目的】
コンマなしdatファイルをcsvファイルに変換する

【使用したもの】 
R for R 4.0.1 GUI 1.72 Catalina build (7845)
コンマなしdatファイル(数字のみ、ファイル名は data.dat)

【手順】
作業ディレクトリの変更

csv.r
x <-read.table("data.dat")
write.table(x,"output.csv",quote=F,col.name=F,sep=",")

また、data.datの内容を転置したcsvファイルを作りたい時は

csv_transpose.r
x <-read.table("data.dat")
y <- t(x)
write.table(y,"output_t.csv",quote=F,col.name=F,sep=",")

【参考】
http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?