2012-08-13 90 views
1

有沒有人知道如何在ff包中使用subset.ff函數?子設置ff數據幀使用subset.ff函數R

下面是數據的一個樣本:

col1 col2 col3 col4 col5 col6 col7 
    1 1 1 1 1 1 0 
    1 1 1 1 1 1 0 
    104 11 3 3 1 1 1089 
    63 11 2 3 9 1 734 
    11 1 3 1 1 1 -609 
    11 1 3 1 1 1 -609 
    11 1 3 1 1 1 -609 

下面是代碼:

temp2a <- subset.ff(temp1,temp1$col7!="0") #temp1 is the name of the ff data frame 

我收到以下錯誤:

Error in `length<-.ffdf`(`*tmp*`, value = 12965531L) : not allowed to change the number of (virtual) columns of ffdf 

我想拿到兩來自數據的數據幀子集。其中col7等於0和col7不等於零的一個。有誰知道如何使用subset.ff函數或其他方式來做我想要的。我試圖通過pdf的ffbase圖書館和遍佈網絡,但我找不到任何例子。

乾杯再次,

洛坎

回答

4

是什麼temp1$col7!="0"給你?是像?subset.ffdf狀態

an expression, ri, bit or logical ff vector that can be used to index x. 

也許你需要將其更改爲temp1$col7 != 0

+0

所以temp2a <-subset(temp1中,temp1中$ COL7!= 0)會爲你的情況可能是工作 – jwijffels 2012-08-13 08:09:05

+0

歡呼聲揚的幫助。修正了錯誤。正如你在答案的第一行所說的那樣,我應該使用subset.ffdf。我不知道有subset.fff的subset.ffdf版本,因爲R中的幫助文件對於ff函數來說並不好。您也對temp1 $ col7!= 0有所瞭解,所以再次感謝您的幫助 – 2012-08-13 09:32:11