簡體   English   中英

將包含字符數據的列添加到ffdf

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM