Created
July 15, 2015 23:53
-
-
Save thmcmahon/4120d679935c90e84944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
data(iris) | |
str(iris['Sepal.Length']) | |
'data.frame': 150 obs. of 1 variable: | |
$ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... | |
str(iris[,'Sepal.Length']) | |
num [1:150] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... | |
iris <- tbl_df(iris) | |
str(iris[,'Sepal.Length']) | |
Classes ‘tbl_df’ and 'data.frame': 150 obs. of 1 variable: | |
$ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The behaviour of subsetting in the matrix fashion changes depending on whether the data frame is a tbl_df or not.