-1

I have a data set where I want to remove every row in which Dataset$a does not have the value "Right". Dataset$a is a list with three diffrent objects "Right", "Wrong1" and "Wrong2". I tried to do this by using the code:

Dataset$a <- subset.ffdf(Dataset, a == "Right")

But I get the error

Error in if (any(B < 1)) stop("B too small") : missing value where TRUE/FALSE needed
In addition: Warning message:
In bbatch(n, as.integer(BATCHBYTES/theobytes)) :
  NAs introduced by coercion to integer range

What should I do instead?

Erik
  • 73
  • 1
  • 8

1 Answers1

0

The warning that is returned has something do in working with a large data set.

see here

Before doing your filter see if row a is a factor or character using:

str(Dataset$a)

If it is in character format, this should work

finalDf <- Dataset[Dataset$a != "Right", ]

Or you can use dplyr like so:

require(dplyr)

newData <- Dataset%>% dplyr::filter(a=="Right")
DataTx
  • 1,839
  • 3
  • 26
  • 49