Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
オブジェクトを「インタプリタで読み取り可能な」方法で印刷する方法があるかどうか疑問に思っています。これにより、次のようになります。
> x <- c(1:5,8) > print.ir(x) c(1,2,3,4,5,8) > x <- matrix(1:4, ncol=2) > print.ir(x) matrix(c(1,2,3,4), ncol=2, nrow=2)
結果をRスクリプトまたは別のRセッションにコピーして貼り付けることができるようにします。
これに使用dput()します:
dput()
x <- c(1:5,8) dput(x) c(1, 2, 3, 4, 5, 8) x <- matrix(1:4, ncol=2) dput(x) structure(1:4, .Dim = c(2L, 2L))
それを試してみてください:
z <- structure(1:4, .Dim = c(2L, 2L)) z [,1] [,2] [1,] 1 3 [2,] 2 4