Re: [R] dplyr and function length()

2015-08-04 Thread Karl Schilling
Dear Jeff: No, the effect I described has nothing to do wit USING dplyr. It occurs with any (preexisting) data.frame once dplyr is LOADED (require(dplyr). It is this silent, sort of backward acting effect that disturbs me. Best, Karl Schilling On 04.08.2015 12:20, Jeff Newmiller wrote: I

Re: [R] dplyr and function length()

2015-08-04 Thread Hadley Wickham
No, the effect I described has nothing to do wit USING dplyr. It occurs with any (preexisting) data.frame once dplyr is LOADED (require(dplyr). It is this silent, sort of backward acting effect that disturbs me. You're going to need to provide some evidence for that charge: dplyr does not

Re: [R] dplyr and function length()

2015-08-04 Thread Hadley Wickham
length(df[,1]). Both commands will return n. However, once dplyr is loaded, length(df[,1]) will return a value of 1. length(df$m1) and also length(df[[1]]) will correctly return n. I know that using length() may not be the most elegant or efficient way to get the value of n. However,

Re: [R] dplyr and function length() and some apologies

2015-08-04 Thread Karl Schilling
Dear Hadley: your request for evidence for my observation seems to have paved the way to solve this issue. As it turns out, the effect I described only occurs with data.frames read in with readxl. Clearly, I missed that these are tbl_df. And that explains the differential behavior depending

Re: [R] dplyr and function length()

2015-08-04 Thread peter dalgaard
On 04 Aug 2015, at 10:50 , Karl Schilling karl.schill...@uni-bonn.de wrote: Dear All, I have an observation / question about how the function length() works once package dplyr is loaded. Say we have a data.frame df with n rows and m columns. Then a way to get the number of rows is to

Re: [R] dplyr and function length()

2015-08-04 Thread Jeff Newmiller
I can confirm that the drop default is different, but keep in mind that it is only changed for a tbl_df so just convert back to data.frame at the end of your dplr operations to get back to your familiar data.frame behavior.