我想将粘贴数据从R复制到剪贴板,然后再复制到powerpoint。由于复制粘贴有很多,我想尽可能多地消除步骤。下面的代码获取了我的数据,但是引号(“”)后来我必须手动删除,这很烦人:
# Data similar to mine:
library(stringi)
dfrm <- cbind(mtcars, str=stri_rand_strings(nrow(mtcars), 5, '[A-Z]'))
# Output similar to what I want:
a <- t(dfrm["Toyota Corolla", c("cyl", "str", "disp", "hp", "drat")])
#
# Toyota Corolla
# cyl "4" # Presence of a string element in
# str "NVQJS" # my vector forces all elements to
# disp "71.1" # become string upon transposition
# hp "65"
# drat "4.22"
# I want to get rid of all labels:
write.table(a, "clipboard", row.names = F, col.names = F)
# This is what it looks like when I paste this:
#
# "4"
# "NVQJS"
# "71.1"
# "65"
# "4.22"
如何删除引号,以便在粘贴时我的数据看起来像这样,无需手动删除引号?感谢。
# Desired result when pasted:
#
# 4
# NVQJS
# 71.1
# 65
# 4.22
答案 0 :(得分:1)
只需将quote=FALSE
添加到write.table
write.table(a, "clipboard", row.names = F, col.names = F, quote=F)