[英]Adding a column with character data to a ffdf
我試圖將Source列添加到ffdf中,但似乎無法使其正常工作...如果它是正常的df,我只會寫
mtcars$NewCol <- "AB"
如果我對ffdf執行此操作,則會返回錯誤
require(ff)
require(ffbase)
mtcarsff <- as.ffdf(mtcars)
mtcars$NewCol <- "testname"
Error in `[[<-.ffdf`(`*tmp*`, i, value = "testname") :
assigned value must be ff
有任何想法嗎?
這應該工作:
mtcarsff$NewCol <- as.ff(
rep(factor("AB"), times = nrow(mtcarsff))
)
請注意,必須將“ AB”視為一個因素,而不是字符。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.