看板 R_Language 關於我們 聯絡資訊
我有code code <- paste(' { for(i in 1:I) { d[i] ~ dnorm(0, sd = 100) } } ') 存成文字檔 write(code,file="code.txt") 請問該怎麼讀回來,等同於 code <- quote( { for(i in 1:I) { d[i] ~ dnorm(0, sd = 100) } } ) 也就是不要有\n \t之類的東西。 我想做這件事的原因是應該editor在讀quote的時候有問題,所以才需要用存檔讀檔的方式。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 202.45.40.236 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1451389745.A.0F6.html
celestialgod: 看不懂XD 12/29 20:03
celestialgod: gsub(' ', '', paste0(readLines(file('code.txt')) 12/29 20:06
celestialgod: ,collapse='')) 12/29 20:06
celestialgod: 不知道你是不是要這個 12/29 20:06