Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205449

Why I need to assign a data.table to a new object to filter rows?

$
0
0

I'm just starting to learn data.table in r and

library(data.table)
data(iris)
iris[Species == 'setosa']

The code above doesn't filter the rows where the species are setosa in the dataset, it just print the rows where the condition is satisfied.

iris <- iris[Species == 'setosa']

The above code works, but I'm wondering what kind of situation I need to assign a new object for the operation to be effective and not just print the results. Also, is there any risk in assigning on the same object?


Viewing all articles
Browse latest Browse all 205449

Trending Articles