Re: [R] dplyr or plyr or both?

2016-09-15 Thread Jeff Newmiller
You are ignoring the warning issued when you load plyr after dplyr and then 
complaining. Simply reversing the sequence of library statements is sufficient 
to fix your example.

I agree that it is not ideal and that using just one at a time is easier, but 
you can use both, and for now a lot of packages use plyr and are not going to 
be rewritten for dplyr because dplyr doesn't do everything plyr does.

The more subtle problem with using both is that you may need to be explicit 
about which package's function to use with dplyr:: or plyr:: notation, so WHERE 
POSSIBLE I also recommend using dplyr.
-- 
Sent from my phone. Please excuse my brevity.

On September 15, 2016 1:28:51 PM PDT, Frans Marcelissen 
 wrote:
>I never realised that nonsense results don’n bother experienced
>users….. Probably I am not experienced wiith my 6years of R
>professional work.
>I think your advise is incomplete: a %>% dplyr::group_by(groep) %>%
>dplyr::summarise(m=mean(v),n=dplyr::n())
>Gives the same problems and makes the line ugly. Or how would you do
>this?
>I stick with my advise: use dplyr. if you do not need plyr: stay away
>from it. If you need it: do not attach it, but use the plyr:: notation.
>I agree that plyr is something else as dplyr, and unfortunately plyr
>will be used for some time.
>
>Verzonden vanuit Mail voor Windows 10
>
>Van: Jeff Newmiller

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] dplyr or plyr or both?

2016-09-15 Thread Frans Marcelissen
I never realised that nonsense results don’n bother experienced users….. 
Probably I am not experienced wiith my 6years of R professional work.
I think your advise is incomplete: a %>% dplyr::group_by(groep) %>% 
dplyr::summarise(m=mean(v),n=dplyr::n())
Gives the same problems and makes the line ugly. Or how would you do this?
I stick with my advise: use dplyr. if you do not need plyr: stay away from it. 
If you need it: do not attach it, but use the plyr:: notation.
I agree that plyr is something else as dplyr, and unfortunately plyr will be 
used for some time.

Verzonden vanuit Mail voor Windows 10

Van: Jeff Newmiller
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] dplyr or plyr or both?

2016-09-15 Thread Jeff Newmiller
The incorrect results are unfortunate and can trip up the inexperienced user, 
but this problem is straightforward to resolve if you explicitly specify which 
versions of the conflicting functions to use. The more interesting question I 
saw was whether the intent is to deprecate plyr, but so far that  does not 
appear to be the case.

While I agree that mixing them can be trouble-prone, I think in many cases both 
will continue to be used. 
-- 
Sent from my phone. Please excuse my brevity.

On September 15, 2016 10:08:05 AM PDT, Frans Marcelissen 
 wrote:
>Hello Christopher and others
>:
>What cannot be stressed enough is: do not combine both packages, it
>gives
>errors and incorrect results! I will show that below
>
>a<-data.frame(groep=1:4,v=1:40)
>library(dplyr)
>a %>% group_by(groep) %>% summarise(m=mean(v),n=n())
># groep m n
>#   
># 1 11910
># 2 22010
># 3 32110
># 4 42210
># correct
>
>library(plyr)
>a %>% group_by(groep) %>% summarise(m=mean(v),n=n())
>
>Error in n() : This function should not be called directly
># ???
>a %>% group_by(groep) %>% summarise(m=mean(v))
># m
># 1 20.5
>#incorrect!
>--
>
>So both n() and group_by from dplyr don't work after library(plyr)!
>
>My advice is: do not use plyr. Unfortunately plyr has some functions
>that
>are very important, and that are not in dplyr. For instance:
>rbind.fill()
>(for combining the rows of two dataframes with unequal columns). If you
>need this: do'nt library plyr, use plyr::rbind.fil
>
>Until now I have the impression that it is also possible to library
>dplyr
>after plyr, but it is better to remove plyr!
>
>This is a serious problem that has been reported before, but not solved
>(in
>dplyr 0.5.0 and plyr 1.8.4)
>
>Frams
>
>2016-09-15 16:09 GMT+02:00 Christopher W Ryan :
>
>> I've set myself the task of learning about these packages, and about
>> tidy data concepts.
>>
>> What is the relationship between plyr and dplyr?  Does the latter
>> replace the former (meaning I can concentrate on learning the
>latter)?
>> Or is there ever a need to use functions from both (meaning I should
>> learn both)?
>>
>> Thanks.
>>
>> --Chris Ryan
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/
>> posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] dplyr or plyr or both?

2016-09-15 Thread Christopher W. Ryan
Thank you Frans. This is exactly the sort of nuance that I want to learn 
about.


--Chris

Frans Marcelissen wrote:

Hello Christopher and others
:
What cannot be stressed enough is: do not combine both packages, it
gives errors and incorrect results! I will show that below

a<-data.frame(groep=1:4,v=1:40)
library(dplyr)
a %>% group_by(groep) %>% summarise(m=mean(v),n=n())
# groep m n
#   
# 1 11910
# 2 22010
# 3 32110
# 4 42210
# correct

library(plyr)
a %>% group_by(groep) %>% summarise(m=mean(v),n=n())

Error in n() : This function should not be called directly
# ???
a %>% group_by(groep) %>% summarise(m=mean(v))
# m
# 1 20.5
#incorrect!
--

So both n() and group_by from dplyr don't work after library(plyr)!

My advice is: do not use plyr. Unfortunately plyr has some functions
that are very important, and that are not in dplyr. For
instance: rbind.fill() (for combining the rows of two dataframes with
unequal columns). If you need this: do'nt library plyr, use plyr::rbind.fil

Until now I have the impression that it is also possible to library
dplyr after plyr, but it is better to remove plyr!

This is a serious problem that has been reported before, but not solved
(in dplyr 0.5.0 and plyr 1.8.4)

Frams

2016-09-15 16:09 GMT+02:00 Christopher W Ryan >:

I've set myself the task of learning about these packages, and about
tidy data concepts.

What is the relationship between plyr and dplyr?  Does the latter
replace the former (meaning I can concentrate on learning the latter)?
Or is there ever a need to use functions from both (meaning I should
learn both)?

Thanks.

--Chris Ryan

__
R-help@r-project.org  mailing list --
To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help

PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] dplyr or plyr or both?

2016-09-15 Thread Frans Marcelissen
Hello Christopher and others
:
What cannot be stressed enough is: do not combine both packages, it gives
errors and incorrect results! I will show that below

a<-data.frame(groep=1:4,v=1:40)
library(dplyr)
a %>% group_by(groep) %>% summarise(m=mean(v),n=n())
# groep m n
#   
# 1 11910
# 2 22010
# 3 32110
# 4 42210
# correct

library(plyr)
a %>% group_by(groep) %>% summarise(m=mean(v),n=n())

Error in n() : This function should not be called directly
# ???
a %>% group_by(groep) %>% summarise(m=mean(v))
# m
# 1 20.5
#incorrect!
--

So both n() and group_by from dplyr don't work after library(plyr)!

My advice is: do not use plyr. Unfortunately plyr has some functions that
are very important, and that are not in dplyr. For instance: rbind.fill()
(for combining the rows of two dataframes with unequal columns). If you
need this: do'nt library plyr, use plyr::rbind.fil

Until now I have the impression that it is also possible to library dplyr
after plyr, but it is better to remove plyr!

This is a serious problem that has been reported before, but not solved (in
dplyr 0.5.0 and plyr 1.8.4)

Frams

2016-09-15 16:09 GMT+02:00 Christopher W Ryan :

> I've set myself the task of learning about these packages, and about
> tidy data concepts.
>
> What is the relationship between plyr and dplyr?  Does the latter
> replace the former (meaning I can concentrate on learning the latter)?
> Or is there ever a need to use functions from both (meaning I should
> learn both)?
>
> Thanks.
>
> --Chris Ryan
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] dplyr or plyr or both?

2016-09-15 Thread Bert Gunter
I see no reason to bother Hadley in the age of google.

Search on "dplyr versus plyr" and read what you get! (on the first hit, even)

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Sep 15, 2016 at 7:20 AM,   wrote:
> Hello,
>
> Maybe you should ask the maintainer of both packages.
>
>> maintainer("plyr")
>
> [1] "Hadley Wickham "
>>
>> maintainer("dplyr")
>
> [1] "Hadley Wickham "
>
> Hope this helps,
>
> Rui Barradas
>
>
>
> Citando Christopher W Ryan :
>
>
>> I've set myself the task of learning about these packages, and about
>> tidy data concepts.
>>
>> What is the relationship between plyr and dplyr?  Does the latter
>> replace the former (meaning I can concentrate on learning the latter)?
>> Or is there ever a need to use functions from both (meaning I should
>> learn both)?
>>
>> Thanks.
>>
>> --Chris Ryan
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] dplyr or plyr or both?

2016-09-15 Thread ruipbarradas

Hello,

Maybe you should ask the maintainer of both packages.


maintainer("plyr")

[1] "Hadley Wickham "

maintainer("dplyr")

[1] "Hadley Wickham "

Hope this helps,

Rui Barradas



Citando Christopher W Ryan :


I've set myself the task of learning about these packages, and about
tidy data concepts.

What is the relationship between plyr and dplyr?  Does the latter
replace the former (meaning I can concentrate on learning the latter)?
Or is there ever a need to use functions from both (meaning I should
learn both)?

Thanks.

--Chris Ryan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] dplyr or plyr or both?

2016-09-15 Thread Christopher W Ryan
I've set myself the task of learning about these packages, and about
tidy data concepts.

What is the relationship between plyr and dplyr?  Does the latter
replace the former (meaning I can concentrate on learning the latter)?
Or is there ever a need to use functions from both (meaning I should
learn both)?

Thanks.

--Chris Ryan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.