1
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でクリップボードからペースト・クリップボードにコピー

Last updated at Posted at 2021-09-10

OSによって違って意外と面倒だったりする。
下にある「もっと簡単に」の方がオススメ

ペースト

たとえばExcelでタイトル付きの表を作ってRに入れたい場合

Windowsの場合
x <- read.table("clipboard", header = T, sep = "\t")
Macの場合
x <- read.table(pipe("pbpaste")), header = T, sep = "\t")

コピー

たとえば何かの表や変数をクリップボードに出したい場合
Macでやる方法はわからない

Windowsの場合
x <- write.table(y, "clipboard")

もっと簡単に

cliprパッケージを使う

OS問わず
library(clipr)
# Paste from clipboard
x <- read_clip_tbl(header = T)
# 表でない場合はread_clip()もある

# Copy to clipboard
write_clip(y)

なんと簡単

1
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
1
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?