[R] dplyr : row total for all groups in dplyr summarise

Roy Mendelssohn - NOAA Federal roy.mendelssohn at noaa.gov
Wed Jul 6 20:59:50 CEST 2016


Thanks muchly.  I hate the smart quotes!

-Roy


> On Jul 6, 2016, at 11:42 AM, David Winsemius <dwinsemius at comcast.net> wrote:
> 
> 
>> On Jul 6, 2016, at 9:45 AM, rmendelss gmail <rmendelss at gmail.com> wrote:
>> 
>> 
>>> On Jul 6, 2016, at 9:36 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>>> 
>>> n this case the text was cut from the R session console text and pasted without modification into Mail.app version 8.2. In replicating this action, I see now that hitting "return" then unfortunately converts the final double-quote to a "smart-quote”.
>> 
>> Speaking of this, this happens to me a lot when I post, so any example code can not be copied and paste to be reproducible.  Does anyone know of a workaround for this?
> 
> Google search: Mail.app changes quotes
> 
> https://discussions.apple.com/thread/7065405?tstart=0
> 
> If this is on a Mac then the answer it to change setting on the Keyboard/text Control Panel: uncheck the Use smart quotes and dashes:
> 
> 
> <PastedGraphic-1.tiff>
> 
> Test:
> 
> mtcars %>%
>    group_by (am, gear) %>%
>    summarise (n=n()) %>%
>    mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>%
>    ungroup() %>% plyr::rbind.fill(data.frame( n=nrow(mtcars),rel.freq="100%"))
> 
> 
> Seems to work.
> -- 
> David
>> 
>> Thanks,
>> 
>> -Roy
>> 
>> 
> 

**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.



More information about the R-help mailing list