Re: [R] Can R read Word fonts and comments?

2016-07-05 Thread John
Thanks, Bob. Regarding other functionalities I would request:
Extract all text with (1) a specific color or (2) a specific font (3)
underlines. For example, if one highlights in red, then she would like to
extract all texts in red. Occasionally she might use more than one colors,
and each color bears its own implication. Thanks!

John



2016-07-05 10:03 GMT-07:00 boB Rudis :

> I'll dig into that (was hoping the small feature addition wld cause
> enhanced feature requests :-)
>
> On Tue, Jul 5, 2016 at 1:02 PM, John  wrote:
> > Thank you, David and Bert, for the info.
> > Thank you, Bob, for this excellent function. Allow me to request a
> feature:
> > You highlighted the following text, and comment "This is the first
> comment".
> >
> > "Lorem ipsum dolor sit amet, cu sit modus voluptua accommodare, meis
> > disputando voluptatibus eu nec, qui te modo solum delicata. Eam scripta
> > maluisset urbanitas et, numquam disputationi in pri, vis tibique deserunt
> > accusamus ut. Vis movet admodum probatus cu, ex pri ludus possit.
> Molestiae
> > efficiendi at vix, eu labore elaboraret deterruisset mei, et eos persius
> > nominati."
> >
> > Could you let the function output the above text (with the comments, of
> > course), which you highlighted for comment?
> >
> > Thanks,
> >
> > John
> >
> >
> >
> > 2016-07-02 14:12 GMT-07:00 boB Rudis :
> >>
> >> I just added `docx_extract_all_cmnts()` (and a cpl other
> >> comments-related things) to the dev version of `docxtractr`
> >> (https://github.com/hrbrmstr/docxtractr). You can use
> >> `devtools::install_github("hrbrmstr/docxtractr")` to install it.
> >> There's an example in the help for that function.
> >>
> >> Give it a go and file detailed issues for other functionality you need.
> >>
> >> On Fri, Jul 1, 2016 at 11:14 PM, David Winsemius <
> dwinsem...@comcast.net>
> >> wrote:
> >> > It’s my understanding that docx and xlsx files are zipped containers
> >> > that have their data in XML files. You should try unzipping one and
> >> > examining it with a viewer. You may then be able to use pkg:XML.
> >> >
> >> > —
> >> > David.
> >> >
> >> >> On Jul 1, 2016, at 3:13 PM, Bert Gunter 
> wrote:
> >> >>
> >> >> No, sorry -- all I would do is search.
> >> >>
> >> >> -- 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 Fri, Jul 1, 2016 at 2:33 PM, John  wrote:
> >> >>> Yes, I have done some search (e.g., tm, markdown, etc), but I can't
> >> >>> find
> >> >>> this function.
> >> >>> If you know any package that works for this purpose, that would be
> >> >>> quite
> >> >>> helpful.
> >> >>> Thanks,
> >> >>>
> >> >>> John
> >> >>>
> >> >>> 2016-06-28 16:50 GMT-07:00 Bert Gunter :
> >> 
> >>  Did you try searching before posting here? -- e.g. a web search or
> on
> >>  rseek.org ?
> >> 
> >>  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 Tue, Jun 28, 2016 at 3:53 PM, John  wrote:
> >> > Hi,
> >> >
> >> >   From time to time I highlight the word documents with red/blue
> >> > color
> >> > or
> >> > italic/bold fonts, and I also add comments to a file. Is there a
> >> > package/function to let R extract the italic/bold blue/red words
> and
> >> > comments from a docx/doc file?
> >> >
> >> >   I am aware that there are a few packages reading Word, but don't
> >> > know
> >> > which one is able to do it.
> >> >
> >> >   Thanks,
> >> >
> >> > John
> >> >
> >> >[[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.
> >> >
> >> > __
> >> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, 

Re: [R] BCa Bootstrapped regression coefficients from lmrob function not working

2016-07-05 Thread Bert Gunter
It would help to show your  error message, n'est-ce pas?

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 Tue, Jul 5, 2016 at 2:51 PM, varin sacha via R-help
 wrote:
> Dear Professor Dalgaard,
>
> I really thank you lots for your response. I have solved my problem. Now, I 
> have tried to do the same (calculate the BCa bootstrapped CIs) for the MARS 
> regression, and I get an error message. If somebody has a hint to solve my 
> problem, would be highly appreciated.
>
> Reproducible example :
>
>
> Dataset = 
> data.frame(PIBparHab=c(43931,67524,48348,44827,52409,15245,24453,57636,28992,17102,51495,47243,40908,22494,12784,48391,44221,32514,35132,46679,106022,9817,99635,38678,49128,12876,20732,17151,19670,41053,22488,57134,83295,10660),
>
> QUALITESANSREDONDANCE=c(1082.5,1066.6,1079.3,1079.9,1074.9,1008.6,1007.5,.3,1108.2,1109.7,1059.6,1165.1,1026.7,1035.1,997.8,1044.8,1073.6,1085.7,1083.8,1021.6,1036.2,1075.3,1069.3,1101.4,1086.9,1072.1,1166.7,983.9,1004.5,1082.5,1123.5,1094.9,1105.1,1010.8),
>
> competitivite=c(89,83,78,73,90,71,77,85,61,67,98,82,70,43,57,78,72,79,61,71,86,63,90,75,87,64,60,56,66,80,53,91,97,62),
>
> innovation=c(56,52,53,54,57,43,54,60,47,55,58,62,52,35,47,59,56,56,45,52,58,33,57,57,61,40,45,41,50,61,50,65,68,34))
>
> install.packages("earth")
>
> library(earth)
>
> newdata=na.omit(Dataset)
>
> model=earth(PIBparHab ~ QUALITESANSREDONDANCE + competitivite + 
> innovation,data=newdata)
>
> summary(model)
>
> plot(model)
>
> plotmo(model)
>
>
> boot.MARS=function(formula,data,indices) {
>
> d=data[indices,]
>
> fit=earth(formula,data=d)
>
> return(coef(fit))
>
> }
>
> library(boot)
>
> results=boot(data=newdata, statistic=boot.MARS, R=1000,formula=PIBparHab ~ 
> QUALITESANSREDONDANCE + competitivite + innovation)
>
> boot.ci(results, type= "bca",index=2)
>
>
> Best,
> S
>
> 
> De : peter dalgaard 
>
> Cc : R-help Mailing List 
> Envoyé le : Dimanche 3 juillet 2016 18h19
> Objet : Re: [R] BCa Bootstrapped regression coefficients from lmrob function 
> not working
>
>
>
>> On 03 Jul 2016, at 13:47 , varin sacha via R-help  
>> wrote:
>>
>> Dear R-experts,
>>
>> I am trying to calculate the bootstrapped (BCa) regression coefficients for 
>> a robust regression using MM-type estimator (lmrob function from robustbase 
>> package).
>>
>> My R code here below is showing a warning message ([1] "All values of t are 
>> equal to
>> 22.2073014256803\n Can not calculate confidence intervals" NULL), I was 
>> wondering if it was because I am trying to fit a robust regression with 
>> lmrob function rather than a simple lm ? I mean maybe the boot.ci function 
>> does not work with lmrob function ? If not, I was wondering what was going 
>> on ?
>
> You need to review your code. You calculate a,b,c,d in the global environment 
> and create newdata as a subset of Dataset, then use a,b,c,d in the formula, 
> but no such variables are in newdata. AFAICT, all your bootstrap fits use the 
> _same_ global values for a,b,c,d hence give the same result 1000 times...
>
> -pd
>
>
>
>>
>> Here is the reproducible example
>>
>>
>> Dataset = 
>> data.frame(PIBparHab=c(43931,67524,48348,44827,52409,15245,24453,57636,28992,17102,51495,47243,40908,22494,12784,48391,44221,32514,35132,46679,106022,9817,99635,38678,49128,12876,20732,17151,19670,41053,22488,57134,83295,10660),
>>
>> QUALITESANSREDONDANCE=c(1082.5,1066.6,1079.3,1079.9,1074.9,1008.6,1007.5,.3,1108.2,1109.7,1059.6,1165.1,1026.7,1035.1,997.8,1044.8,1073.6,1085.7,1083.8,1021.6,1036.2,1075.3,1069.3,1101.4,1086.9,1072.1,1166.7,983.9,1004.5,1082.5,1123.5,1094.9,1105.1,1010.8),
>>
>> competitivite=c(89,83,78,73,90,71,77,85,61,67,98,82,70,43,57,78,72,79,61,71,86,63,90,75,87,64,60,56,66,80,53,91,97,62),
>>
>> innovation=c(56,52,53,54,57,43,54,60,47,55,58,62,52,35,47,59,56,56,45,52,58,33,57,57,61,40,45,41,50,61,50,65,68,34))
>>
>> library("robustbase")
>> newdata=na.omit(Dataset)
>> a=Dataset$PIBparHab
>> b=Dataset$QUALITESANSREDONDANCE
>> c=Dataset$competitivite
>> d=Dataset$innovation
>>
>> fm.lmrob=lmrob(a~b+c+d,data=newdata)
>> fm.lmrob
>>
>> boot.Lmrob=function(formula,data,indices) {
>> d=data[indices,]
>> fit=lmrob(formula,data=d)
>> return(coef(fit))
>> }
>>
>> library(boot)
>> results=boot(data=newdata, statistic=boot.Lmrob, R=1000,formula=a~b+c+d)
>> boot.ci(results, type= "bca",index=2)
>>
>>
>> Any help would be highly appreciated,
>> S
>>
>> __
>> 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.
>
> --
> Peter Dalgaard, 

Re: [R] BCa Bootstrapped regression coefficients from lmrob function not working

2016-07-05 Thread varin sacha via R-help
Dear Professor Dalgaard,

I really thank you lots for your response. I have solved my problem. Now, I 
have tried to do the same (calculate the BCa bootstrapped CIs) for the MARS 
regression, and I get an error message. If somebody has a hint to solve my 
problem, would be highly appreciated.

Reproducible example :


Dataset = 
data.frame(PIBparHab=c(43931,67524,48348,44827,52409,15245,24453,57636,28992,17102,51495,47243,40908,22494,12784,48391,44221,32514,35132,46679,106022,9817,99635,38678,49128,12876,20732,17151,19670,41053,22488,57134,83295,10660),

QUALITESANSREDONDANCE=c(1082.5,1066.6,1079.3,1079.9,1074.9,1008.6,1007.5,.3,1108.2,1109.7,1059.6,1165.1,1026.7,1035.1,997.8,1044.8,1073.6,1085.7,1083.8,1021.6,1036.2,1075.3,1069.3,1101.4,1086.9,1072.1,1166.7,983.9,1004.5,1082.5,1123.5,1094.9,1105.1,1010.8),

competitivite=c(89,83,78,73,90,71,77,85,61,67,98,82,70,43,57,78,72,79,61,71,86,63,90,75,87,64,60,56,66,80,53,91,97,62),

innovation=c(56,52,53,54,57,43,54,60,47,55,58,62,52,35,47,59,56,56,45,52,58,33,57,57,61,40,45,41,50,61,50,65,68,34))

install.packages("earth")

library(earth)

newdata=na.omit(Dataset)

model=earth(PIBparHab ~ QUALITESANSREDONDANCE + competitivite + 
innovation,data=newdata)

summary(model)

plot(model)

plotmo(model)


boot.MARS=function(formula,data,indices) {

d=data[indices,]

fit=earth(formula,data=d)

return(coef(fit))

}

library(boot)

results=boot(data=newdata, statistic=boot.MARS, R=1000,formula=PIBparHab ~ 
QUALITESANSREDONDANCE + competitivite + innovation)

boot.ci(results, type= "bca",index=2)


Best,
S


De : peter dalgaard 

Cc : R-help Mailing List 
Envoyé le : Dimanche 3 juillet 2016 18h19
Objet : Re: [R] BCa Bootstrapped regression coefficients from lmrob function 
not working



> On 03 Jul 2016, at 13:47 , varin sacha via R-help  
> wrote:
> 
> Dear R-experts,
> 
> I am trying to calculate the bootstrapped (BCa) regression coefficients for a 
> robust regression using MM-type estimator (lmrob function from robustbase 
> package).
> 
> My R code here below is showing a warning message ([1] "All values of t are 
> equal to 
> 22.2073014256803\n Can not calculate confidence intervals" NULL), I was 
> wondering if it was because I am trying to fit a robust regression with lmrob 
> function rather than a simple lm ? I mean maybe the boot.ci function does not 
> work with lmrob function ? If not, I was wondering what was going on ?

You need to review your code. You calculate a,b,c,d in the global environment 
and create newdata as a subset of Dataset, then use a,b,c,d in the formula, but 
no such variables are in newdata. AFAICT, all your bootstrap fits use the 
_same_ global values for a,b,c,d hence give the same result 1000 times...

-pd



> 
> Here is the reproducible example
> 
> 
> Dataset = 
> data.frame(PIBparHab=c(43931,67524,48348,44827,52409,15245,24453,57636,28992,17102,51495,47243,40908,22494,12784,48391,44221,32514,35132,46679,106022,9817,99635,38678,49128,12876,20732,17151,19670,41053,22488,57134,83295,10660),
> 
> QUALITESANSREDONDANCE=c(1082.5,1066.6,1079.3,1079.9,1074.9,1008.6,1007.5,.3,1108.2,1109.7,1059.6,1165.1,1026.7,1035.1,997.8,1044.8,1073.6,1085.7,1083.8,1021.6,1036.2,1075.3,1069.3,1101.4,1086.9,1072.1,1166.7,983.9,1004.5,1082.5,1123.5,1094.9,1105.1,1010.8),
> 
> competitivite=c(89,83,78,73,90,71,77,85,61,67,98,82,70,43,57,78,72,79,61,71,86,63,90,75,87,64,60,56,66,80,53,91,97,62),
> 
> innovation=c(56,52,53,54,57,43,54,60,47,55,58,62,52,35,47,59,56,56,45,52,58,33,57,57,61,40,45,41,50,61,50,65,68,34))
> 
> library("robustbase")
> newdata=na.omit(Dataset)
> a=Dataset$PIBparHab
> b=Dataset$QUALITESANSREDONDANCE
> c=Dataset$competitivite
> d=Dataset$innovation
> 
> fm.lmrob=lmrob(a~b+c+d,data=newdata)
> fm.lmrob
> 
> boot.Lmrob=function(formula,data,indices) {
> d=data[indices,]
> fit=lmrob(formula,data=d)
> return(coef(fit))
> }
> 
> library(boot)
> results=boot(data=newdata, statistic=boot.Lmrob, R=1000,formula=a~b+c+d)
> boot.ci(results, type= "bca",index=2)
> 
> 
> Any help would be highly appreciated,
> S
> 
> __
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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-es] ayuda frecuencia asistencia clase

2016-07-05 Thread Javier Marcuzzi
Estimado Sebastián Kruk

La respuesta es sí, pero su mensaje sale difícil de interpretar en mi 
computadora.

No comprendo correctamente su pregunta, creo que todos los libros deben tener 
un ejemplo de R y frecuencias, su problema no entra en mi cabeza.

Javier Rubén Marcuzzi

De: Sebastian Kruk
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] How to extract "specific"/"last" intercept value from segmented package.

2016-07-05 Thread David L Carlson
You should use only plain text emails, provide sample data, and indicate any 
relevant packages that you had to load. First let's load the necessary package 
and create some data:

> library(segmented)
> set.seed(42)
> x <- sort(runif(60, 10, 60))
> int <- c(rep(0, 20), rep(60, 20), rep(-80, 20))
> slp <- c(rep(2, 20), rep(0, 20), rep(3, 20))
> y <- int + slp*x + rnorm(60, 0, 2)
> plot(x, y)

You should have a plot showing 2 break points. Using psi=mean(x) puts a single 
breakpoint in the middle of the distribtution so we have to be more specific:

> lin.mod <- lm(y~x)
> segmented.mod <- segmented(lin.mod, seg.Z = ~x, psi= c(25, 55))
> plot(segmented.mod, add=T)
> sl <- slope(segmented.mod)
> inter <- intercept(segmented.mod)

Now your plot shows the segmented model. You need to know what intercept() is 
returning so you should look at the manual page: ?intercept. It returns a list 
of matrices (one matrix for each independent variable). You have only one, x, 
so you get a list with one element.

> str(inter)
List of 1
 $ x: num [1:3, 1] -0.179 60.25 -86.77
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "intercept1" "intercept2" "intercept3"
  .. ..$ : chr "Est."

To get the first matrix without knowing its name and the last row:

> tail(inter[[1]], 1)
 Est.
intercept3 -86.77

If you want to strip off the labels:

> as.vector(tail(inter[[1]], 1))
[1] -86.77

-
David L. Carlson
Department of Anthropology
Texas A University



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Narendra Modi
Sent: Tuesday, July 5, 2016 1:42 PM
To: R-help@r-project.org
Subject: [R] How to extract "specific"/"last" intercept value from segmented 
package.

I am able to perform regression on a dataset as below:

plot(x,y)
lin.mod <- lm(y~x)
m <- mean(x)
m

segmented.mod <- segmented(lin.mod, seg.Z = ~x, psi= m)

plot(segmented.mod, add=T)
sl <- slope(segmented.mod)
inter <- intercept(segmented.mod)

summary(segmented.mod)# Show Summary
sl# show all the slopes
inter # show all the intercepts


In my dataset, the above method correctly identifies the breakpoints and
hence I get two intercepts.

> inter
$x
  Est.
intercept1  -3.269
intercept2 -19.980

What I am interested is the "intercept2" value. How can I obtain this?

The method needs to be dynamic as in if the next dataset has 3 intercepts,
I would like to get "intercept3 value.

PD

[[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] How to extract "specific"/"last" intercept value from segmented package.

2016-07-05 Thread ruipbarradas
Hello,

Try

dimnames(inter$x)[[1]]

You could have seen this by inspecting 'inter':

str(inter)

Hope this helps,

Rui Barradas
 

Citando Narendra Modi :

> I am able to perform regression on a dataset as below:
>
> plot(x,y)
> lin.mod <- lm(y~x)
> m <- mean(x)
> m
>
> segmented.mod <- segmented(lin.mod, seg.Z = ~x, psi= m)
>
> plot(segmented.mod, add=T)
> sl <- slope(segmented.mod)
> inter <- intercept(segmented.mod)
>
> summary(segmented.mod)    # Show Summary
> sl                        # show all the slopes
> inter                     # show all the intercepts
>
> In my dataset, the above method correctly identifies the breakpoints and
> hence I get two intercepts.
>> inter
>
> $x
>              Est.
> intercept1  -3.269
> intercept2 -19.980
>
> What I am interested is the "intercept2" value. How can I obtain this?
>
> The method needs to be dynamic as in if the next dataset has 3 intercepts,
> I would like to get "intercept3 value.
>
> PD
>
>         [[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.htmland 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] How to extract "specific"/"last" intercept value from segmented package.

2016-07-05 Thread Narendra Modi
I am able to perform regression on a dataset as below:

plot(x,y)
lin.mod <- lm(y~x)
m <- mean(x)
m

segmented.mod <- segmented(lin.mod, seg.Z = ~x, psi= m)

plot(segmented.mod, add=T)
sl <- slope(segmented.mod)
inter <- intercept(segmented.mod)

summary(segmented.mod)# Show Summary
sl# show all the slopes
inter # show all the intercepts


In my dataset, the above method correctly identifies the breakpoints and
hence I get two intercepts.

> inter
$x
  Est.
intercept1  -3.269
intercept2 -19.980

What I am interested is the "intercept2" value. How can I obtain this?

The method needs to be dynamic as in if the next dataset has 3 intercepts,
I would like to get "intercept3 value.

PD

[[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-es] ayuda frecuencia asistencia clase

2016-07-05 Thread Sebastian Kruk
Estimados usurios-R:

Tengo una lista de alumnos.

Hay alguna forma de sacar una tabla de frecuencias por la asistencia a
clases mensual.
Es decir cuantos días concurrió cada alumno en el mes.
Supongamos que la lista está conformada por ocho alumnos, el curso duró 4
días y quiero saber cuantos días concurrió cada uno al curso poniendolo en
la columna mes.

Quisiera obtener un cuadro así:

Alumnos Dia 1 Dia 2 Dia 3 Dia 4 Mes Pedro si 1 Juan si si si si 4 Carlos si
si 2 Daniel si si 2 Florencia si si 2 Ana 0 Paula si 1 Ximena si si 2
Gracias de antemano.

Saludos,

Sebastián.

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Can R read Word fonts and comments?

2016-07-05 Thread boB Rudis
I'll dig into that (was hoping the small feature addition wld cause
enhanced feature requests :-)

On Tue, Jul 5, 2016 at 1:02 PM, John  wrote:
> Thank you, David and Bert, for the info.
> Thank you, Bob, for this excellent function. Allow me to request a feature:
> You highlighted the following text, and comment "This is the first comment".
>
> "Lorem ipsum dolor sit amet, cu sit modus voluptua accommodare, meis
> disputando voluptatibus eu nec, qui te modo solum delicata. Eam scripta
> maluisset urbanitas et, numquam disputationi in pri, vis tibique deserunt
> accusamus ut. Vis movet admodum probatus cu, ex pri ludus possit. Molestiae
> efficiendi at vix, eu labore elaboraret deterruisset mei, et eos persius
> nominati."
>
> Could you let the function output the above text (with the comments, of
> course), which you highlighted for comment?
>
> Thanks,
>
> John
>
>
>
> 2016-07-02 14:12 GMT-07:00 boB Rudis :
>>
>> I just added `docx_extract_all_cmnts()` (and a cpl other
>> comments-related things) to the dev version of `docxtractr`
>> (https://github.com/hrbrmstr/docxtractr). You can use
>> `devtools::install_github("hrbrmstr/docxtractr")` to install it.
>> There's an example in the help for that function.
>>
>> Give it a go and file detailed issues for other functionality you need.
>>
>> On Fri, Jul 1, 2016 at 11:14 PM, David Winsemius 
>> wrote:
>> > It’s my understanding that docx and xlsx files are zipped containers
>> > that have their data in XML files. You should try unzipping one and
>> > examining it with a viewer. You may then be able to use pkg:XML.
>> >
>> > —
>> > David.
>> >
>> >> On Jul 1, 2016, at 3:13 PM, Bert Gunter  wrote:
>> >>
>> >> No, sorry -- all I would do is search.
>> >>
>> >> -- 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 Fri, Jul 1, 2016 at 2:33 PM, John  wrote:
>> >>> Yes, I have done some search (e.g., tm, markdown, etc), but I can't
>> >>> find
>> >>> this function.
>> >>> If you know any package that works for this purpose, that would be
>> >>> quite
>> >>> helpful.
>> >>> Thanks,
>> >>>
>> >>> John
>> >>>
>> >>> 2016-06-28 16:50 GMT-07:00 Bert Gunter :
>> 
>>  Did you try searching before posting here? -- e.g. a web search or on
>>  rseek.org ?
>> 
>>  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 Tue, Jun 28, 2016 at 3:53 PM, John  wrote:
>> > Hi,
>> >
>> >   From time to time I highlight the word documents with red/blue
>> > color
>> > or
>> > italic/bold fonts, and I also add comments to a file. Is there a
>> > package/function to let R extract the italic/bold blue/red words and
>> > comments from a docx/doc file?
>> >
>> >   I am aware that there are a few packages reading Word, but don't
>> > know
>> > which one is able to do it.
>> >
>> >   Thanks,
>> >
>> > John
>> >
>> >[[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.
>> >
>> > __
>> > 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

Re: [R] Can R read Word fonts and comments?

2016-07-05 Thread John
Thank you, David and Bert, for the info.
Thank you, Bob, for this excellent function. Allow me to request a feature:
You highlighted the following text, and comment "This is the first
comment".

"Lorem ipsum dolor sit amet, cu sit modus voluptua accommodare, meis
disputando voluptatibus eu nec, qui te modo solum delicata. Eam scripta
maluisset urbanitas et, numquam disputationi in pri, vis tibique deserunt
accusamus ut. Vis movet admodum probatus cu, ex pri ludus possit. Molestiae
efficiendi at vix, eu labore elaboraret deterruisset mei, et eos persius
nominati."

Could you let the function output the above text (with the comments, of
course), which you highlighted for comment?

Thanks,

John



2016-07-02 14:12 GMT-07:00 boB Rudis :

> I just added `docx_extract_all_cmnts()` (and a cpl other
> comments-related things) to the dev version of `docxtractr`
> (https://github.com/hrbrmstr/docxtractr). You can use
> `devtools::install_github("hrbrmstr/docxtractr")` to install it.
> There's an example in the help for that function.
>
> Give it a go and file detailed issues for other functionality you need.
>
> On Fri, Jul 1, 2016 at 11:14 PM, David Winsemius 
> wrote:
> > It’s my understanding that docx and xlsx files are zipped containers
> that have their data in XML files. You should try unzipping one and
> examining it with a viewer. You may then be able to use pkg:XML.
> >
> > —
> > David.
> >
> >> On Jul 1, 2016, at 3:13 PM, Bert Gunter  wrote:
> >>
> >> No, sorry -- all I would do is search.
> >>
> >> -- 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 Fri, Jul 1, 2016 at 2:33 PM, John  wrote:
> >>> Yes, I have done some search (e.g., tm, markdown, etc), but I can't
> find
> >>> this function.
> >>> If you know any package that works for this purpose, that would be
> quite
> >>> helpful.
> >>> Thanks,
> >>>
> >>> John
> >>>
> >>> 2016-06-28 16:50 GMT-07:00 Bert Gunter :
> 
>  Did you try searching before posting here? -- e.g. a web search or on
>  rseek.org ?
> 
>  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 Tue, Jun 28, 2016 at 3:53 PM, John  wrote:
> > Hi,
> >
> >   From time to time I highlight the word documents with red/blue
> color
> > or
> > italic/bold fonts, and I also add comments to a file. Is there a
> > package/function to let R extract the italic/bold blue/red words and
> > comments from a docx/doc file?
> >
> >   I am aware that there are a few packages reading Word, but don't
> know
> > which one is able to do it.
> >
> >   Thanks,
> >
> > John
> >
> >[[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.
> >
> > __
> > 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.
>

[[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] Antwort: Re: dplyr : row total for all groups in dplyr summarise

2016-07-05 Thread David Winsemius

> On Jul 5, 2016, at 2:27 AM, g.maub...@weinwolf.de wrote:
> 
> Hi guys,
> 
> I checked out your example but I can't follow the results.:
> 
>> mtcars %>%
> +   group_by (am, gear) %>%
> +   summarise (n=n()) %>%
> +   mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>%
> +   ungroup() %>%
> +   mutate(row.tot = sum(n))
> Source: local data frame [4 x 5]
> 
> am  gear n rel.freq row.tot
>  (dbl) (dbl) (int)(chr)   (int)
> 1 0 315  79%  32
> 2 0 4 4  21%  32
> 3 1 4 8  62%  32
> 4 1 5 5  38%  32
> 
> We have a total of 32 cases and 15 * 100 / 32 = 48,9 % instead of 79 %. 
> The same with the other columns. How is 79 % calculated?
> 

It is apparently the number of items in the first “group determinant” 

> mtcars %>%
+group_by (am, gear) %>%
+summarise (n=n()) %>%
+mutate(sum = sum(n)) %>%
+ungroup()
Source: local data frame [4 x 4]

 am  gear n   sum
  (dbl) (dbl) (int) (int)
1 0 31519
2 0 4 419
3 1 4 813
4 1 5 513
> ?n
> with(mtcars,table(am,gear))
   gear
am   3  4  5
  0 15  4  0
  1  0  8  5

The documentation for the `n` functions is particularly unhelpful in letting 
one know what to expect from it:

"Description

This function is implemented special for each data source and can only be used 
from within summarise, mutate and filter"
— 

David.


> When searching the web I saw this example:
> 
> -- cut --
> 
> #-- not run --
> url <- "http://www.lock5stat.com/datasets/HollywoodMovies2011.csv;
> response <- GET(url)
> Hollywoodmovies2011 <- content(x = GET(url), as = data.frame)
> #-- end not run
> 
> Hollywoodmovies2011 %>% 
>  group_by(genre) %>%
>  summarize(count = n()) %>%
>  mutate(rf = count / sum(count))
> 
> -- cut --
> 
> which gives
> 
> Source: local data frame [9 x 3]
> 
>  Genre count   %
> (fctr) (int)   (dbl)
> 1Action32 0.235294118
> 2 Adventure 1 0.007352941
> 3 Animation12 0.088235294
> 4Comedy27 0.198529412
> 5 Drama21 0.154411765
> 6   Fantasy 2 0.014705882
> 7Horror17 0.12500
> 8   Romance11 0.080882353
> 9  Thriller13 0.095588235
> 
> Here the % correspond to the count and the sum of count, e. g. sum = 136 
> and 32 / 136 = 0,2352941.
> 
> What is the difference when counting? What do the relative counts in the 
> first example mean?
> 
> Kind regards
> 
> Georg
> 
> 
> 
> 
> 
> Von:Ulrik Stervbo 
> An: David Winsemius , 
> Kopie:  r-help@r-project.org, mai...@infomed.sld.cu
> Datum:  05.07.2016 06:06
> Betreff:Re: [R] dplyr : row total for all groups in dplyr 
> summarise
> Gesendet von:   "R-help" 
> 
> 
> 
> That will give you the wrong result when used on summarised data
> 
> David Winsemius  schrieb am Di., 5. Juli 2016 
> 02:10:
> 
>> I thought there was an nrow() function?
>> 
>> Sent from my iPhone
>> 
>> On Jul 4, 2016, at 9:59 AM, Ulrik Stervbo  
> wrote:
>> 
>> If you want the total number of rows in the original data.frame after
>> counting the rows in each group, you can ungroup and sum the row counts,
>> like:
>> 
>> library("dplyr")
>> 
>> 
>> mtcars %>%
>>   group_by (am, gear) %>%
>>   summarise (n=n()) %>%
>>   mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>%
>>   ungroup() %>%
>>   mutate(row.tot = sum(n))
>> 
>> HTH
>> Ulrik
>> 
>> On Mon, 4 Jul 2016 at 18:23 David Winsemius 
>> wrote:
>> 
>>> 
 On Jul 4, 2016, at 6:56 AM, mai...@infomed.sld.cu wrote:
 
 Hello,
 How can I aggregate row total for all groups in dplyr summarise ?
>>> 
>>> Row total … of what? Aggregate … how? What is the desired answer?
>>> 
>>> 
>>> 
 library(dplyr)
 mtcars %>%
 group_by (am, gear) %>%
 summarise (n=n()) %>%
 mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%"))
 
 best regard
 Maicel Monzon
 
 
 
 
 
 
 
 
 --
 Este mensaje le ha llegado mediante el servicio de correo electronico
>>> que ofrece Infomed para respaldar el cumplimiento de las misiones del
>>> Sistema Nacional de Salud. La persona que envia este correo asume el
>>> compromiso de usar el servicio a tales fines y cumplir con las 
> regulaciones
>>> establecidas
 
 Infomed: http://www.sld.cu/
 
 __
 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 -- 

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

2016-07-05 Thread David Winsemius


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%”))


> On Jul 5, 2016, at 4:47 AM, mai...@infomed.sld.cu wrote:
> 
> Sorry, what I wanted to do was to add a total row at the end of the summary. 
> The marginal totals by columns correspond to 100% and the sum of levels.
> best reagard
> Maicel Monzon
> 
> 
> Ulrik Stervbo  escribió:
> 
>> Yes. But in the sample code the data is summarised. In which case you get 4
>> rows and not the correct 32.
>> 
>> On Tue, 5 Jul 2016, 07:48 David Winsemius,  wrote:
>> 
>>> nrow(mtcars)
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>> On Jul 4, 2016, at 9:03 PM, Ulrik Stervbo  wrote:
>>> 
>>> That will give you the wrong result when used on summarised data
>>> 
>>> David Winsemius  schrieb am Di., 5. Juli 2016
>>> 02:10:
>>> 
 I thought there was an nrow() function?
 
 Sent from my iPhone
 
 On Jul 4, 2016, at 9:59 AM, Ulrik Stervbo 
 wrote:
 
 If you want the total number of rows in the original data.frame after
 counting the rows in each group, you can ungroup and sum the row counts,
 like:
 
 library("dplyr")
 
 
 mtcars %>%
   group_by (am, gear) %>%
   summarise (n=n()) %>%
   mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>%
   ungroup() %>%
   mutate(row.tot = sum(n))
 
 HTH
 Ulrik
 
 On Mon, 4 Jul 2016 at 18:23 David Winsemius 
 wrote:
 
> 
> > On Jul 4, 2016, at 6:56 AM, mai...@infomed.sld.cu wrote:
> >
> > Hello,
> > How can I aggregate row total for all groups in dplyr summarise ?
> 
> Row total ? of what? Aggregate ? how? What is the desired answer?
> 
> 
> 
> > library(dplyr)
> > mtcars %>%
> >  group_by (am, gear) %>%
> >  summarise (n=n()) %>%
> >  mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%"))
> >
> > best regard
> > Maicel Monzon
> >
> >
> >
> > 
> >
> >
> >
> >
> > --
> > Este mensaje le ha llegado mediante el servicio de correo electronico
> que ofrece Infomed para respaldar el cumplimiento de las misiones del
> Sistema Nacional de Salud. La persona que envia este correo asume el
> compromiso de usar el servicio a tales fines y cumplir con las 
> regulaciones
> establecidas
> >
> > Infomed: http://www.sld.cu/
> >
> > __
> > 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.
 
 
>> 
> 
> 
> 
> 
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> 
> --
> Este mensaje le ha llegado mediante el servicio de correo electronico que 
> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
> Nacional de Salud. La persona que envia este correo asume el compromiso de 
> usar el servicio a tales fines y cumplir con las regulaciones establecidas
> 
> Infomed: http://www.sld.cu/
> 

__
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] R-3.3.1 RPM release

2016-07-05 Thread Sangalli Cristiano Giovanni (Ext. - UniCredit Business Integrated Solutions)
Thanks a lot Mac for your kind answer.
In the meanwhile I could successfully build the 3.3.1 on a CentOS 6.3 (VM)

Anyway I will contact Tom as you suggest.

Thanks and regards,
Cristiano

-Original Message-
From: Marc Schwartz [mailto:marc_schwa...@me.com] 
Sent: Tuesday, July 05, 2016 1:30 PM
To: Sangalli Cristiano Giovanni (Ext. - UniCredit Business Integrated Solutions)
Cc: R-help
Subject: Re: [R] R-3.3.1 RPM release


> On Jul 4, 2016, at 9:37 AM, Sangalli Cristiano Giovanni (Ext. - UniCredit 
> Business Integrated Solutions)  wrote:
> 
> Dear CRAN,
> 
> I have installed on a RHEL 5.7 server the recent R-3.3.0 rpm but I would like 
> to upgrade to the latest now available R-3.3.1 . I have not found so far the 
> rpm, I would like to know if and when it will be available?
> 
> Thanks in advance,
> Cris
> 

Hi,

The CRAN team does not build RPMs for RH and Fedora, that is done via RH 
maintainers and released via the EPEL:

  https://fedoraproject.org/wiki/EPEL

As an FYI, there is a dedicated SIG list for R on RH/Fedora and the RH 
maintainers (e.g. Tom Callaway) read that list:

  https://stat.ethz.ch/mailman/listinfo/r-sig-fedora

You should post there and Tom can provide a sense of when 3.3.1 will be made 
available.

At present, there is no indication that 3.3.1 is in the R build queue, which 
can be viewed at:

  https://bodhi.fedoraproject.org/updates/?packages=R

Regards,

Marc Schwartz


This e-mail is confidential and may also contain privileged information. If you 
are not the intended recipient you are not authorised to read, print, save, 
process or disclose this message. If you have received this message by mistake, 
please inform the sender immediately and delete this e-mail, its attachments 
and any copies.
Any use, distribution, reproduction or disclosure by any person other than the 
intended recipient is strictly prohibited and the person responsible may incur 
penalties.
Thank you!

__
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] Problems with parallel processing using the foreach package

2016-07-05 Thread Giacomo May

Dear R-users,
I am trying my hand at parallel processing in R using the foreach package but 
it is not working as I want it to. I am using a function I created myself 
(Xenopus_Walk) which returns a vector. Now I would like to run this function 
for every number that is saved in a vector (newly_populated_vec) and obtain a 
list that stores a every vector that has been created as one element of said 
list. The command I am currently using is the following (I guess you can ignore 
most of it since that's mostly only exported packages and parameters my 
function relies on):

no_cores <- detectCores()-1
cl <- makeCluster(no_cores)
registerDoParallel(cl)
Xenopus_Data <- 
foreach(b=1:length(newly_populated_vec),.combine=list,.multicombine=TRUE,.packages
 = c("raster", "gdistance", "rgdal","sp")) %dopar% { 
Xenopus_Walk(altdata=altdata,water=water,habitat_suitability=habitat_suitability,max_range_without_water=max_range_without_water,max_range=max_range,slope=slope,Start_Pt=newly_populated_vec[b])
 }

The problem I have now is that the length of the returned list (Xenopus_Data) 
si different from the length of the vector I retrieve the iterator from 
(newly_populated_vec):

> length(Xenopus_Data) [1] 47
> length(newly_populated_vec) [1] 2027

While trying to figure out what is wrong I have read that one has to split up 
the workload into equal chunks and pass each of them to a core but as you 
probably can tell my understanding of all this is pretty low. I am have a total 
of 32 cores at my disposition. Does anyone know why I have this problem and 
maybe also a way to solve it ? I know that reproducible examples are desired, 
but the function I use is pretty long and I doubt anyone is going to work 
through it. Still, if I can help make things clearer by providing additional 
information I will be glad to do so! Any type of help is greatly appreciated. 
Thanks in advance!
EDIT: I forgot to add that when I look at the list it is nested, so I don't get 
one element for every number in the vector but I get one element with multiple 
sub-elements. Just in case that helps.

__
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] BesselK dll file use in VBA

2016-07-05 Thread Mehta, Gaurang
Hi Team,
I want to use R's Bessel dll file in VBA.
Can anyone help with the commands? Have you used it?
Regards,
Gaurang Mehta


This email is intended for the person or company named and access by anyone 
else is unauthorised. If you are not the person or company named, please delete 
this email and notify the sender.

The information in this email, including any attachments, may be confidential 
or legally privileged (meaning that its disclosure is protected in law). Its 
unauthorised disclosure, copying, distribution or use is prohibited and may be 
unlawful.

Email communications sent over the internet are not guaranteed to be secure or 
virus-free and such messages are potentially at risk.  The Royal London Group 
accepts no liability for any claims arising from use of the internet to 
transmit messages by or to any company within the Royal London Group.

The Royal London Group consists of The Royal London Mutual Insurance Society 
Limited and its subsidiaries.

The Royal London Mutual Insurance Society Limited is authorised by the 
Prudential Regulation Authority and regulated by the Financial Conduct 
Authority and the Prudential Regulation Authority and provides life assurance 
and pensions.

Registered in England and Wales number 99064.

Registered office: 55 Gracechurch Street, London, EC3V 0RL.

In the Republic of Ireland: The Royal London Mutual Insurance Society Limited 
is authorised by the Prudential Regulation Authority in the UK and is regulated 
by the Central Bank of Ireland for conduct of business rules.


[[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 : row total for all groups in dplyr summarise

2016-07-05 Thread maicel
Sorry, what I wanted to do was to add a total row at the end of the  
summary. The marginal totals by columns correspond to 100% and the sum  
of levels.

best reagard
Maicel Monzon


Ulrik Stervbo  escribió:


Yes. But in the sample code the data is summarised. In which case you get 4
rows and not the correct 32.

On Tue, 5 Jul 2016, 07:48 David Winsemius,  wrote:


nrow(mtcars)


Sent from my iPhone

On Jul 4, 2016, at 9:03 PM, Ulrik Stervbo  wrote:

That will give you the wrong result when used on summarised data

David Winsemius  schrieb am Di., 5. Juli 2016
02:10:


I thought there was an nrow() function?

Sent from my iPhone

On Jul 4, 2016, at 9:59 AM, Ulrik Stervbo 
wrote:

If you want the total number of rows in the original data.frame after
counting the rows in each group, you can ungroup and sum the row counts,
like:

library("dplyr")


mtcars %>%
   group_by (am, gear) %>%
   summarise (n=n()) %>%
   mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>%
   ungroup() %>%
   mutate(row.tot = sum(n))

HTH
Ulrik

On Mon, 4 Jul 2016 at 18:23 David Winsemius 
wrote:



> On Jul 4, 2016, at 6:56 AM, mai...@infomed.sld.cu wrote:
>
> Hello,
> How can I aggregate row total for all groups in dplyr summarise ?

Row total ? of what? Aggregate ? how? What is the desired answer?



> library(dplyr)
> mtcars %>%
>  group_by (am, gear) %>%
>  summarise (n=n()) %>%
>  mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%"))
>
> best regard
> Maicel Monzon
>
>
>
> 
>
>
>
>
> --
> Este mensaje le ha llegado mediante el servicio de correo electronico
que ofrece Infomed para respaldar el cumplimiento de las misiones del
Sistema Nacional de Salud. La persona que envia este correo asume el
compromiso de usar el servicio a tales fines y cumplir con las  
regulaciones

establecidas
>
> Infomed: http://www.sld.cu/
>
> __
> 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.














--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

__
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] R-3.3.1 RPM release

2016-07-05 Thread Marc Schwartz

> On Jul 4, 2016, at 9:37 AM, Sangalli Cristiano Giovanni (Ext. - UniCredit 
> Business Integrated Solutions)  wrote:
> 
> Dear CRAN,
> 
> I have installed on a RHEL 5.7 server the recent R-3.3.0 rpm but I would like 
> to upgrade to the latest now available R-3.3.1 . I have not found so far the 
> rpm, I would like to know if and when it will be available?
> 
> Thanks in advance,
> Cris
> 

Hi,

The CRAN team does not build RPMs for RH and Fedora, that is done via RH 
maintainers and released via the EPEL:

  https://fedoraproject.org/wiki/EPEL

As an FYI, there is a dedicated SIG list for R on RH/Fedora and the RH 
maintainers (e.g. Tom Callaway) read that list:

  https://stat.ethz.ch/mailman/listinfo/r-sig-fedora

You should post there and Tom can provide a sense of when 3.3.1 will be made 
available.

At present, there is no indication that 3.3.1 is in the R build queue, which 
can be viewed at:

  https://bodhi.fedoraproject.org/updates/?packages=R

Regards,

Marc Schwartz

__
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] Antwort: Re: dplyr : row total for all groups in dplyr summarise

2016-07-05 Thread G . Maubach
Hi guys,

I checked out your example but I can't follow the results.:

> mtcars %>%
+   group_by (am, gear) %>%
+   summarise (n=n()) %>%
+   mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>%
+   ungroup() %>%
+   mutate(row.tot = sum(n))
Source: local data frame [4 x 5]

 am  gear n rel.freq row.tot
  (dbl) (dbl) (int)(chr)   (int)
1 0 315  79%  32
2 0 4 4  21%  32
3 1 4 8  62%  32
4 1 5 5  38%  32

We have a total of 32 cases and 15 * 100 / 32 = 48,9 % instead of 79 %. 
The same with the other columns. How is 79 % calculated?

When searching the web I saw this example:

-- cut --

#-- not run --
url <- "http://www.lock5stat.com/datasets/HollywoodMovies2011.csv;
response <- GET(url)
Hollywoodmovies2011 <- content(x = GET(url), as = data.frame)
#-- end not run

Hollywoodmovies2011 %>% 
  group_by(genre) %>%
  summarize(count = n()) %>%
  mutate(rf = count / sum(count))

-- cut --

which gives

Source: local data frame [9 x 3]

  Genre count   %
 (fctr) (int)   (dbl)
1Action32 0.235294118
2 Adventure 1 0.007352941
3 Animation12 0.088235294
4Comedy27 0.198529412
5 Drama21 0.154411765
6   Fantasy 2 0.014705882
7Horror17 0.12500
8   Romance11 0.080882353
9  Thriller13 0.095588235

Here the % correspond to the count and the sum of count, e. g. sum = 136 
and 32 / 136 = 0,2352941.

What is the difference when counting? What do the relative counts in the 
first example mean?

Kind regards

Georg





Von:Ulrik Stervbo 
An: David Winsemius , 
Kopie:  r-help@r-project.org, mai...@infomed.sld.cu
Datum:  05.07.2016 06:06
Betreff:Re: [R] dplyr : row total for all groups in dplyr 
summarise
Gesendet von:   "R-help" 



That will give you the wrong result when used on summarised data

David Winsemius  schrieb am Di., 5. Juli 2016 
02:10:

> I thought there was an nrow() function?
>
> Sent from my iPhone
>
> On Jul 4, 2016, at 9:59 AM, Ulrik Stervbo  
wrote:
>
> If you want the total number of rows in the original data.frame after
> counting the rows in each group, you can ungroup and sum the row counts,
> like:
>
> library("dplyr")
>
>
> mtcars %>%
>group_by (am, gear) %>%
>summarise (n=n()) %>%
>mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>%
>ungroup() %>%
>mutate(row.tot = sum(n))
>
> HTH
> Ulrik
>
> On Mon, 4 Jul 2016 at 18:23 David Winsemius 
> wrote:
>
>>
>> > On Jul 4, 2016, at 6:56 AM, mai...@infomed.sld.cu wrote:
>> >
>> > Hello,
>> > How can I aggregate row total for all groups in dplyr summarise ?
>>
>> Row total … of what? Aggregate … how? What is the desired answer?
>>
>>
>>
>> > library(dplyr)
>> > mtcars %>%
>> >  group_by (am, gear) %>%
>> >  summarise (n=n()) %>%
>> >  mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%"))
>> >
>> > best regard
>> > Maicel Monzon
>> >
>> >
>> >
>> > 
>> >
>> >
>> >
>> >
>> > --
>> > Este mensaje le ha llegado mediante el servicio de correo electronico
>> que ofrece Infomed para respaldar el cumplimiento de las misiones del
>> Sistema Nacional de Salud. La persona que envia este correo asume el
>> compromiso de usar el servicio a tales fines y cumplir con las 
regulaciones
>> establecidas
>> >
>> > Infomed: http://www.sld.cu/
>> >
>> > __
>> > 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.
>
>

 [[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.