I have a data frame and tried to select only the observations I’m interested in by this:
data[data["Var1"]>10]
Unfortunately, this command destroys the data.frame structure and returns a long vector.
What I want to get is the data.frame shortened by the observations that don’t match my criteria.
You are missing a comma in your statement.
Try this:
Or:
Or:
As an example, try it on the built-in dataset,
mtcars