Re: [R] Getting Started

2017-01-10 Thread Dalthorp, Daniel
By "contribute", do you mean you have a package (or potential package) that
you'd like to share? Or do you have something else in mind?

-Dan

On Tue, Jan 10, 2017 at 9:33 AM, Lakshya Agrawal 
wrote:

> Hello,
>  I would like to contribute to R i have gone over the development page but
> could find anything on how to get started .Please can someone help me
> getting started. Sorry if i have overlooked something.
>
> [[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.
>
>


-- 
Dan Dalthorp, PhD
USGS Forest and Rangeland Ecosystem Science Center
Forest Sciences Lab, Rm 189
3200 SW Jefferson Way
Corvallis, OR 97331
ph: 541-750-0953
ddalth...@usgs.gov

[[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] Getting Started

2017-01-10 Thread Bert Gunter
You obviously know little about R or you would not have asked that
question. So heeding Jim's advice is clearly your first step. A second
would be to read the "Writing R extensions" manual to learn about R
packages. A third would be to check out the CRAN task views to get a sense
of what's available in the 3000 or more packages users have already
contributed.

Cheers,

Bert

On Jan 10, 2017 1:50 PM, "Lakshya Agrawal" 
wrote:

> Hello,
>  I would like to contribute to R i have gone over the development page but
> could find anything on how to get started .Please can someone help me
> getting started. Sorry if i have overlooked something.
>
> [[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.
>

[[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] Getting Started

2017-01-10 Thread Jim Lemon
Hi Lakshya,
One good way to contribute is to try to do something in R, and if you
see a way to do it better or more easily, you may have an improvement
that will find its way into R. This usually involves a lot of
discovering that someone else has already done it, but as your
knowledge of R expands, so do the opportunities to find something that
no one has yet accomplished.

Jim


On Wed, Jan 11, 2017 at 4:33 AM, Lakshya Agrawal
 wrote:
> Hello,
>  I would like to contribute to R i have gone over the development page but
> could find anything on how to get started .Please can someone help me
> getting started. Sorry if i have overlooked something.
>
> [[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-es] AYUDA TukeyHSD

2017-01-10 Thread Emilio L. Cano
Hola,

Una forma rápida de convertir todos los nombres de columnas una vez
importados los datos es:

names(nombredeldataframe) <- make.names(names(nombredeldataframe)

Un saludo,
Emilio


El 10 de enero de 2017, 19:51, Carlos J. Gil Bellosta 
escribió:

> Primero, deberías hacer
>
> TukeyHSD(ANOVAGalMan3, "Sample*`Purification-step`",ordered = TRUE)
>
> Segundo, ni eso te va a funcionar. Cambia el nombre de tus columnas para
> que no tengan guiones ni tengas que usar comillas.
>
> Arrastrar nombres con caracteres inválidos es garantía de problemas.
>
> Un saludo,
>
> Carlos J. Gil Bellosta
> http://www.datanalytics.com
>
> El 10 de enero de 2017, 19:34, Pilar Vilaro 
> escribió:
>
> > Hola,
> > estoy intentando hacer un Tukey post test y no me lo permite.
> > Hice el anova con aov sin problemas, pero al hacer el Tukey, me dice:
> >
> > > TukeyHSD(ANOVAGalMan3,Sample*`Purification-step`,ordered = TRUE)Error
> > in `[.data.frame`(mf, mf.cols[[i]]) : undefined columns selected
> >
> >
> > aclaro que ANOVAGalMan3 es el resultado de anova.
> >
> > la tabla origen tiene la estructura:
> >
> > Sample Purification-step Total-sugar-content Total-protein-content
> > G-M-ratio
> > Prosopis affinis Yo 63,5 4,2 1,4
> >
> > y tiene algunos datos faltantes que aparecen como NA
> >
> > alguno puede ayudarme?
> > muchas gracias saludos
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-help-es mailing list
> > R-help-es@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-help-es
> >
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 

*Emilio López Cano*
Data Scientist

Mobile: +34 665 676 225
skype: emilopezcano
twitter: @emilopezcano
http://emilio.lcano.com

*Affiliations / Collaborations:*
Rey Juan Carlos University
University of Castilla-La Mancha
Comunidad R-Hispano
AEC - AENOR - SKITES - talentyon

[[alternative HTML version deleted]]

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


[R] Revolutions blog: December 2016 roundup

2017-01-10 Thread David Smith via R-help
Since 2008, Microsoft (formerly Revolution Analytics) staff and guests have 
written about R every weekday at the
Revolutions blog: http://blog.revolutionanalytics.com
and every month I post a summary of articles from the previous month of 
particular interest to readers of r-help.

And in case you missed them, here are some articles related to R from the month 
of December:

Power BI now has a gallery of custom visualizations built with R:
http://blog.revolutionanalytics.com/2016/12/power-bi-custom-visuals-based-on-r.html

Chicago's Department of Public Health uses R to prioritize health inspections 
at restaurants:
http://blog.revolutionanalytics.com/2016/12/food-inspection-forecasting.html

A beautiful map of Switzerland municipalities combined with a relief map of the 
mountains, created with R:
http://blog.revolutionanalytics.com/2016/12/swiss-map.html

Using the Azure Interface Tool to parallelize the problem of optimizing an R 
model across the hyperparameter space:
http://blog.revolutionanalytics.com/2016/12/azure-r-interface-tool.html

A primer on Bayesian Statistics: 
http://blog.revolutionanalytics.com/2016/12/bayesian-inference.html

Animating Voronoi tesselations in R to create a greeting card:
http://blog.revolutionanalytics.com/2016/12/merry-christmas.html

The Linux Data Science Virtual Machine, which includes several R-related 
components, is available for a free "test
drive" on Azure: 
http://blog.revolutionanalytics.com/2016/12/dsvm-test-drive.html

The new AzureSMR package lets you manage Azure virtual machines, clusters and 
storage from R:
http://blog.revolutionanalytics.com/2016/12/azuresmr.html

Interactive decision trees in Microsoft R Server:
http://blog.revolutionanalytics.com/2016/12/interactive-decision-trees-with-microsoft-r.html

The ompr package provides numerical optimization with mixed integer programming:
http://blog.revolutionanalytics.com/2016/12/mixed-integer-programming-in-r-with-the-ompr-package.html

Predicting flu deaths in China with R: 
http://blog.revolutionanalytics.com/2016/12/predicting-flu-deaths.html

Using the circlize package and Microsoft R Server's Spark interface to 
visualize millions of taxi trips:
http://blog.revolutionanalytics.com/2016/12/taxi-mrs-spark.html

The State of Indiana uses R to forecast employment:
http://blog.revolutionanalytics.com/2016/12/state-of-indiana-employment.html

"One Page R" is a free, multi-chapter tutorial on data science topics with R:
http://blog.revolutionanalytics.com/2016/12/one-page-r.html

The Deputy Chief Economist at Freddie Mac used R to animate the different rates 
of housing price increases around the
world: http://blog.revolutionanalytics.com/2016/12/housing-prices.html

I gave a talk about the value of ecosystems to open source projects, using R as 
an example:
http://blog.revolutionanalytics.com/2016/12/the-value-of-rs-open-source-ecosystem.html

A summary of some recent projects funded by the R Consortium:
http://blog.revolutionanalytics.com/2016/12/r-consortium-projects-update.html 

Microsoft R Server 9.0, featuring R 3.3.2 and support for Spark 2.0, is now 
available:
http://blog.revolutionanalytics.com/2016/12/microsoft-r-server-90-now-available.html

The dplyrXdf package has been updated with new features for managing XDF data 
sets in Microsoft R:
http://blog.revolutionanalytics.com/2016/12/dplyrxdf-090-now-available.html

A stylometric analysis of the speeches of the Prime Minister of Pakistan:
http://blog.revolutionanalytics.com/2016/12/stylometry.html

Using R and the d3heatmap package to visualize the emotional journey of 
characters in "War and Peace":
http://blog.revolutionanalytics.com/2016/12/war-and-peace.html#more

General interest stories (not related to R) in the past month included: the 
horrors of 2016
(http://blog.revolutionanalytics.com/2016/12/because-its-friday-goodbye-2016.html),
 a Machinima Christmas carol
(http://blog.revolutionanalytics.com/2016/12/because-its-friday-a-christmas-destiny.html),
 freezing bubbles
(http://blog.revolutionanalytics.com/2016/12/because-its-friday-im-forever-freezing-bubbles.html),
 dark comics
(http://blog.revolutionanalytics.com/2016/12/because-its-friday-angst-in-four-panels.html),
 and a virtual flight along
the US-Mexico border 
(http://blog.revolutionanalytics.com/2016/12/because-its-friday-border.html).

If you're looking for more articles about R, you can find summaries from 
previous months at
http://blog.revolutionanalytics.com/roundups/. You can receive daily blog posts 
via email using services like
blogtrottr.com.

As always, thanks for the comments and please keep sending suggestions to me at 
david...@microsoft.com or via Twitter
(I'm @revodavid).

Cheers,
# David

-- 
David M Smith 
R Community Lead, Microsoft  
Tel: +1 (312) 9205766 (Chicago IL, USA)
Twitter: @revodavid | Blog:  http://blog.revolutionanalytics.com

__
R-help@r-project.org mailing list -- To 

Re: [R-es] Cut con skaprlyr

2017-01-10 Thread Carlos Ortega
Hola,

Si tienes el data.frame en Spark, y estás utilizando "sparklyr" (es lo que
entiendo del título de tu pregunta) entonces puedes utilizar los verbos de
"dplyr", en este caso el verbo a aplicar es el "select()".

Y sería algo así como esto, utilizando los pipes:

tu_data_frame_cortado <- tu_data_frame_spark %>% select(columna_A,
columna_B, columna_H:columna_M)

En la sintaxis "dplyr" puedes llegar a especificar un rango de columnas
como incluyo en el ejemplo "columna_H:columna_M".

Puedes ver un ejemplo de cómo aplicarlo en la propia home de la página de
"sparklyr".

Nota: por cierto, "cut()" no se aplica a data.frames directamente, si no a
vectores.

Saludos,
Carlos Ortega
www.qualityexcellence.es

2017-01-10 19:05 GMT+01:00 Jesús Para Fernández <
j.para.fernan...@hotmail.com>:

>
> Buenas
>
> Quiero cortar un dataframe usando cut, pero no se como hacerlo con un data
> frame de spark
>
> Alguna idea??
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[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-es] AYUDA TukeyHSD

2017-01-10 Thread Carlos J. Gil Bellosta
Primero, deberías hacer

TukeyHSD(ANOVAGalMan3, "Sample*`Purification-step`",ordered = TRUE)

Segundo, ni eso te va a funcionar. Cambia el nombre de tus columnas para
que no tengan guiones ni tengas que usar comillas.

Arrastrar nombres con caracteres inválidos es garantía de problemas.

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com

El 10 de enero de 2017, 19:34, Pilar Vilaro 
escribió:

> Hola,
> estoy intentando hacer un Tukey post test y no me lo permite.
> Hice el anova con aov sin problemas, pero al hacer el Tukey, me dice:
>
> > TukeyHSD(ANOVAGalMan3,Sample*`Purification-step`,ordered = TRUE)Error
> in `[.data.frame`(mf, mf.cols[[i]]) : undefined columns selected
>
>
> aclaro que ANOVAGalMan3 es el resultado de anova.
>
> la tabla origen tiene la estructura:
>
> Sample Purification-step Total-sugar-content Total-protein-content
> G-M-ratio
> Prosopis affinis Yo 63,5 4,2 1,4
>
> y tiene algunos datos faltantes que aparecen como NA
>
> alguno puede ayudarme?
> muchas gracias saludos
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

[[alternative HTML version deleted]]

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


[R] Getting Started

2017-01-10 Thread Lakshya Agrawal
Hello,
 I would like to contribute to R i have gone over the development page but
could find anything on how to get started .Please can someone help me
getting started. Sorry if i have overlooked something.

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

2017-01-10 Thread Pilar Vilaro
Hola,
estoy intentando hacer un Tukey post test y no me lo permite.
Hice el anova con aov sin problemas, pero al hacer el Tukey, me dice:

> TukeyHSD(ANOVAGalMan3,Sample*`Purification-step`,ordered = TRUE)Error in 
> `[.data.frame`(mf, mf.cols[[i]]) : undefined columns selected


aclaro que ANOVAGalMan3 es el resultado de anova.

la tabla origen tiene la estructura:

Sample Purification-step Total-sugar-content Total-protein-content
G-M-ratio
Prosopis affinis Yo 63,5 4,2 1,4

y tiene algunos datos faltantes que aparecen como NA

alguno puede ayudarme?
muchas gracias saludos

[[alternative HTML version deleted]]

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


[R] Announcing the biggest French-speaking R Conference in North America - R à Québec 2017

2017-01-10 Thread Pierre Racine
We are posting this info here because most French-speaking R users in North 
America use this forum even if English is not their first language.

Le comité scientifique du Colloque R à Québec 2017 (http://raquebec.ulaval.ca) 
recueille jusqu'au 15 janvier 2017 des propositions de conférences touchant, 
entre autres, aux thèmes suivants :

.statistiques descriptives
.analyse et traitement de données
.visualisation et graphiques
.modélisation, optimisation et simulation
.calcul haute performance
.forage de données
.applications en recherche, en enseignement ou dans les secteurs public 
ou privé

Dans une perspective d'interdisciplinarité, l'accent de la conférence doit 
porter sur l'utilisation de R. Les présentations se dérouleront en français et 
elles seront d'une durée de 20 minutes. Il est possible que les auteurs de 
propositions de conférences non retenues soient invités à présenter sous forme 
d'affiche. Les conférenciers devront s'inscrire et payer leurs frais 
d'inscription.

La date limite pour soumettre une présentation est le 15 janvier 2017.

R à Québec 2017 (raquebec.ulaval.ca) est un colloque interdisciplinaire 
rassemblant chercheurs, étudiants, praticiens et professionnels des milieux 
académiques, gouvernementaux et industriels. À l'instar des conférences useR, 
ce premier colloque d'envergure au Québec dédié spécifiquement à l'utilisation 
de R favorisera le transfert d'expertise entre les disciplines, l'avancement 
des pratiques et, pour certains, le passage vers l'environnement R. La première 
journée sera consacrée à des ateliers de formation introductifs et avancés et 
la deuxième à des conférences. Le colloque aura lieu les 25 et 26 mai 2017.

Comité scientifique :

.Alexandre Bureau - Département de médecine sociale et préventive, 
Université Laval
.Anne-Sophie Charest - Département de mathématiques et statistique, 
Université Laval
.Arnaud Droit - Département de médecine moléculaire, Université Laval
.Vincent Goulet - École d'actuariat, Université Laval
.Charles Fleury - Département de sociologie, Université Laval

Pour toute information sur l'appel de conférence, contactez Vincent Goulet 
(vincent.gou...@act.ulaval.ca). Pour toute autre information sur R à Québec 
2017, contactez Natacha Fontaine (raque...@ulaval.ca) ou visitez notre site web 
: http://raquebec.ulaval.ca.

__
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] PNG File in R Markdown HTML

2017-01-10 Thread Jeff Newmiller
Someone here may have an answer for you,  but in general to solve this you need 
to use CSS which implies you also need to understand HTML, and neither of these 
subjects are on topic here (where the topic is the R language). Once you know 
what you want the output of knitr to look like then you need to learn how to 
get that code through knitr, which has its own mailing list. If you are lucky 
someone may have already made an rmarkdown template you could use or modify. 
You might try Googling "rmarkdown logo html".
-- 
Sent from my phone. Please excuse my brevity.

On January 10, 2017 5:57:01 AM PST, Shivi Bhatia  wrote:
>Hi Team,
>
>I am successfully able to add the company logo to the R markdown file
>using
>the code below:
>
>```{r, fig.width=3, fig.height=15,echo=FALSE, warning=FALSE,
>message=FALSE}
>library(png)
>library(grid)
>img <- readPNG("D:/Shivi/R Project/Name.png")
> grid.raster(img)
>```
>However the image gets displayed at the bottom of the html page. I have
>tried deleting any empty space after this code but it does not help.
>
>Request you to please advice.
>Thanks, Shivi
>
>   [[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 proof the trend of two columns of data?

2017-01-10 Thread David L Carlson
As Rui noted, to get a trend you need to focus on percent gray vs age since 
hair color is not an ordinal/rank variable. Then use a measure of association 
designed for rank variables of which there are many: Spearman’s r, Kendall’s 
tau, gamma, tau-c, Somers-d. All of them are available in package DescTools.

David C

From: vod vos [mailto:vod...@zoho.com]
Sent: Tuesday, January 10, 2017 6:03 AM
To: David L Carlson
Cc: Rui Barradas; r-help
Subject: Re: [R] how to proof the trend of two columns of data?

as far as I know,  ?kruskal.test will show us the differences between three or 
more groups. But it could show the trend.


 On 星期一, 09 一月 2017 10:12:14 -0800 David L Carlson 
> wrote 

The list does not assist with homework problems. If this is not a class 
assignment, you should be more specific about what you have tried and provide a 
reproducible example (a sample of the real data or some made-up data that has 
the same columns and data types). In the meantime you could also try the 
following R command:

> ?kruskal.test

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352

-Original Message-
From: R-help 
[mailto:r-help-boun...@r-project.org] On 
Behalf Of Rui Barradas
Sent: Monday, January 9, 2017 11:28 AM
To: vod vos; r-help
Subject: Re: [R] how to proof the trend of two columns of data?

Hello,

Inline.

Em 09-01-2017 14:55, vod vos escreveu:
> Hello everyone,
>
>
>
> If there are two columns, one is age (numeric, cut to several groups), the 
> other is hair color type(factor: yellow, black, white).
>
>
>
> If the age column is not normal distributed

If you use ?lm, it's the residuals that should be normally distributed,
not age.
You can also use ?glm with a binomial link, in which case you should
recode type as white/not white.

Hope this helps,

Rui Barradas

, which statistic method should use to prove the trend relationship
between them, for example, the older has more probability of white hair
type? Are there any existed R package to figure out this situation?
>
>
>
> Thank you.
>
>
>
>
> [[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.




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] Assessing the name of an object within an argument

2017-01-10 Thread Hadley Wickham
You might find http://adv-r.had.co.nz/Computing-on-the-language.html helpful.

Hadley

On Tue, Jan 10, 2017 at 2:49 AM,   wrote:
> Hi All,
>
> I have a function like
>
> my_func <- function(dataset)
> {
>   some operation
> }
>
> Now I would like not only to operate on the dataset (how this is done is
> obvious) but I would like to get the name of the dataset handed over as an
> argument.
>
> Example:
>
> my_func <- function(dataset = iris)
> {
>   print(dataset)  # here I do not want to print the dataset but the name
> of the object - iris in this case - instead
>   # quote() does not do the trick cause it prints "dataset" instead of
> "iris"
>   # as.name() gives an error saying that the object can not coerced to a
> symbol
> }
>
> Is there a way to do this?
>
> Kind regards
>
> Georg
>
> __
> 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.



-- 
http://hadley.nz

__
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] error in an univariate integration involving a bivariate normal CDF

2017-01-10 Thread William Dunlap via R-help
  integrand=function(xx,y=1,MU=MU,Sigma=Sigma)
{
  
dnorm(xx,mean=MU[1],sd=sqrt(Sigma[1,1]))*pmvnorm(lower=c(-Inf,-Inf),upper=c(xx,y),mean=MU,sigma=Sigma)

}

The integrand must be a function that returns a vector the length of
its first argument (integrate will pass it a short vector of input
values).  It looks like your function expects 'xx' to be a scalar.
You can use the Vectorize function to fix things up.


Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Jan 9, 2017 at 3:28 PM, Jingqin luo via R-help
 wrote:
> R users,I encountered some error message when trying a univariate integration 
> involving a bivariate normal CDF with mean MU and variance matrix Sigma. 
> Below are my code:MU=c(1,3)
> Sigma=matrix(c(1,0.5,0.5,1.5),2,2)
> integrand=function(xx,y=1,MU=MU,Sigma=Sigma)
>   {
> 
> dnorm(xx,mean=MU[1],sd=sqrt(Sigma[1,1]))*pmvnorm(lower=c(-Inf,-Inf),upper=c(xx,y),mean=MU,sigma=Sigma)
>
>   }
>   
> integrate(integrand,y=1,MU=MU,Sigma=Sigma,lower=-Inf,upper=Inf,subdivisions=1000)gave
>  : Error in checkmvArgs(lower = lower, upper = upper, mean = mean, corr = 
> corr, : ‘diag(sigma)’ and ‘lower’ are of different length.The error came from 
> the pmvnorm() part. I will appreciate any hints to this error.> sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-redhat-linux-gnu (64-bit)
> Running under: Red Hat Enterprise Linux Server release 6.2 (Santiago)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
>  [1] pbivnorm_0.6.0 ggplot2_1.0.0  pROC_1.8   copula_0.999-11
>  [5] mvtnorm_1.0-0  lcmix_0.3  nnls_1.4   MASS_7.3-45
>  [9] matrixStats_0.10.0 R.methodsS3_1.6.1  psych_1.6.9
>
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.1  munsell_0.4.2mnormt_1.5-1 ADGofTest_0.3
>  [5] colorspace_1.2-4 pspline_1.0-16   lattice_0.20-29  stringr_0.6.2
>  [9] plyr_1.8.1   tcltk_3.3.1  tools_3.3.1  parallel_3.3.1
> [13] grid_3.3.1   gtable_0.1.2 digest_0.6.4 Matrix_1.1-4
> [17] reshape2_1.4 labeling_0.3 scales_0.2.4 gsl_1.9-10
> [21] stats4_3.3.1 stabledist_0.6-6 foreign_0.8-66   proto_0.3-10
>
> [[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] error in an univariate integration involving a bivariate normal CDF

2017-01-10 Thread Jingqin luo via R-help
R users,I encountered some error message when trying a univariate integration 
involving a bivariate normal CDF with mean MU and variance matrix Sigma. Below 
are my code:MU=c(1,3)
Sigma=matrix(c(1,0.5,0.5,1.5),2,2)
integrand=function(xx,y=1,MU=MU,Sigma=Sigma)
  {

dnorm(xx,mean=MU[1],sd=sqrt(Sigma[1,1]))*pmvnorm(lower=c(-Inf,-Inf),upper=c(xx,y),mean=MU,sigma=Sigma)

  }
  
integrate(integrand,y=1,MU=MU,Sigma=Sigma,lower=-Inf,upper=Inf,subdivisions=1000)gave
 : Error in checkmvArgs(lower = lower, upper = upper, mean = mean, corr = corr, 
: ‘diag(sigma)’ and ‘lower’ are of different length.The error came from the 
pmvnorm() part. I will appreciate any hints to this error.> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.2 (Santiago)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C  
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C 
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 

other attached packages:
 [1] pbivnorm_0.6.0 ggplot2_1.0.0  pROC_1.8   copula_0.999-11   
 [5] mvtnorm_1.0-0  lcmix_0.3  nnls_1.4   MASS_7.3-45   
 [9] matrixStats_0.10.0 R.methodsS3_1.6.1  psych_1.6.9   

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.1  munsell_0.4.2mnormt_1.5-1 ADGofTest_0.3   
 [5] colorspace_1.2-4 pspline_1.0-16   lattice_0.20-29  stringr_0.6.2   
 [9] plyr_1.8.1   tcltk_3.3.1  tools_3.3.1  parallel_3.3.1  
[13] grid_3.3.1   gtable_0.1.2 digest_0.6.4 Matrix_1.1-4
[17] reshape2_1.4 labeling_0.3 scales_0.2.4 gsl_1.9-10  
[21] stats4_3.3.1 stabledist_0.6-6 foreign_0.8-66   proto_0.3-10

[[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] how to proof the trend of two columns of data?

2017-01-10 Thread vod vos
as far as I know,  ?kruskal.test will show us the differences between three or 
more groups. But it could show the trend. 




 On 星期一, 09 一月 2017 10:12:14 -0800 David L Carlson 
dcarl...@tamu.edu wrote 




The list does not assist with homework problems. If this is not a class 
assignment, you should be more specific about what you have tried and provide a 
reproducible example (a sample of the real data or some made-up data that has 
the same columns and data types). In the meantime you could also try the 
following R command: 

 

 ?kruskal.test 

 

- 

David L Carlson 

Department of Anthropology 

Texas AM University 

College Station, TX 77840-4352 



-Original Message- 

From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rui Barradas 

Sent: Monday, January 9, 2017 11:28 AM 

To: vod vos; r-help 

Subject: Re: [R] how to proof the trend of two columns of data? 



Hello, 



Inline. 



Em 09-01-2017 14:55, vod vos escreveu: 

 Hello everyone, 

 

 

 

 If there are two columns, one is age (numeric, cut to several groups), the 
other is hair color type(factor: yellow, black, white). 

 

 

 

 If the age column is not normal distributed 



If you use ?lm, it's the residuals that should be normally distributed, 

not age. 

You can also use ?glm with a binomial link, in which case you should 

recode type as white/not white. 



Hope this helps, 



Rui Barradas 



, which statistic method should use to prove the trend relationship 

between them, for example, the older has more probability of white hair 

type? Are there any existed R package to figure out this situation? 

 

 

 

 Thank you. 

 

 

 

 

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











[[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: [ESS] [emacs-ess/ESS] require Emacs 24.3 or higher (c7a2306)

2017-01-10 Thread Sparapani, Rodney
I was just being pro-active.  24.1 and 24.2 are so buggy they should be 
withdrawn
(except on Windows ironically).  Given the many hours I have already spent 
debugging
these emacs bugs (which are fixed in 24.3), I don’t think we should do anything 
to
support these versions.  The users will be better off spending their time 
upgrading
rather than trying to fix what can’t be fixed.

--
Rodney Sparapani, PhD
Assistant Professor of Biostatistics
Medical College of Wisconsin, Milwaukee

From: Martin Mächler 
Reply-To: emacs-ess/ESS 

Date: Tuesday, January 10, 2017 at 3:03 AM
To: emacs-ess/ESS 
Cc: Rodney Sparapani , Author 
Subject: Re: [emacs-ess/ESS] require Emacs 24.3 or higher (c7a2306)

Sorry, I haven't seen this (also the discussion on ESS-help was not at all 
completed)...
I rather read in the last version of this file that we do support Emacs 24 and 
25,
so I have committed small changes that should allow 24.2 ..
__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

[R] PNG File in R Markdown HTML

2017-01-10 Thread Shivi Bhatia
Hi Team,

I am successfully able to add the company logo to the R markdown file using
the code below:

```{r, fig.width=3, fig.height=15,echo=FALSE, warning=FALSE, message=FALSE}
library(png)
library(grid)
img <- readPNG("D:/Shivi/R Project/Name.png")
 grid.raster(img)
```
However the image gets displayed at the bottom of the html page. I have
tried deleting any empty space after this code but it does not help.

Request you to please advice.
Thanks, Shivi

[[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] Assessing the name of an object within an argument

2017-01-10 Thread Thomas Mailund
Yes, I was too fast there, sorry. I sent a correction right after but must have 
picked Reply instead of Replay All.

Cheers
Thomas



On 10 January 2017 at 10:31:30, Bert Gunter 
(bgunter.4...@gmail.com) wrote:

This is false. formals() gives the FORMAL argument list of the function, not 
the ACTUAL arguments supplied. That is obtained by the construction

deparse(substitute(dataset))

The OP should consult a good R tutorial for this and other uses of 
substitute(), part of the "computing on the language" functionality of R.

Bert



On Jan 10, 2017 4:04 AM, "Thomas Mailund" 
> wrote:

You can get that using `formals()`.

my_func <- function(dataset = iris)
{
  #print(dataset) # here I do not want to print the dataset but the name
  # of the object - iris in this case - instead

  print(formals()$dataset) # this is what you want
}

This gives you what the arguments were as an alist. It won’t always be a name, 
of course, but when it is, as in this case, that will be a symbol you can print.

Cheers
Thomas



On 10 January 2017 at 09:51:55, 
g.maub...@weinwolf.de 
(g.maub...@weinwolf.de(mailto:g.maub...@weinwolf.de))
 wrote:

> Hi All,
>
> I have a function like
>
> my_func <- function(dataset)
> {
> some operation
> }
>
> Now I would like not only to operate on the dataset (how this is done is
> obvious) but I would like to get the name of the dataset handed over as an
> argument.
>
> Example:
>
> my_func <- function(dataset = iris)
> {
> print(dataset) # here I do not want to print the dataset but the name
> of the object - iris in this case - instead
> # quote() does not do the trick cause it prints "dataset" instead of
> "iris"
> # as.name() gives an error saying that the object can not 
> coerced to a
> symbol
> }
>
> Is there a way to do this?
>
> Kind regards
>
> Georg
>
> __
> 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] Assessing the name of an object within an argument

2017-01-10 Thread Bert Gunter
This is false. formals() gives the FORMAL argument list of the function,
not the ACTUAL arguments supplied. That is obtained by the construction

deparse(substitute(dataset))

The OP should consult a good R tutorial for this and other uses of
substitute(), part of the "computing on the language" functionality of R.

Bert



On Jan 10, 2017 4:04 AM, "Thomas Mailund"  wrote:


You can get that using `formals()`.

my_func <- function(dataset = iris)
{
  #print(dataset) # here I do not want to print the dataset but the name
  # of the object - iris in this case - instead

  print(formals()$dataset) # this is what you want
}

This gives you what the arguments were as an alist. It won’t always be a
name, of course, but when it is, as in this case, that will be a symbol you
can print.

Cheers
Thomas



On 10 January 2017 at 09:51:55, g.maub...@weinwolf.de (g.maub...@weinwolf.de
(mailto:g.maub...@weinwolf.de)) wrote:

> Hi All,
>
> I have a function like
>
> my_func <- function(dataset)
> {
> some operation
> }
>
> Now I would like not only to operate on the dataset (how this is done is
> obvious) but I would like to get the name of the dataset handed over as an
> argument.
>
> Example:
>
> my_func <- function(dataset = iris)
> {
> print(dataset) # here I do not want to print the dataset but the name
> of the object - iris in this case - instead
> # quote() does not do the trick cause it prints "dataset" instead of
> "iris"
> # as.name() gives an error saying that the object can not coerced to a
> symbol
> }
>
> Is there a way to do this?
>
> Kind regards
>
> Georg
>
> __
> 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] Assessing the name of an object within an argument

2017-01-10 Thread Thomas Mailund
 
You can get that using `formals()`.  

my_func <- function(dataset = iris)  
{
  #print(dataset) # here I do not want to print the dataset but the name  
  # of the object - iris in this case - instead

  print(formals()$dataset) # this is what you want
}

This gives you what the arguments were as an alist. It won’t always be a name, 
of course, but when it is, as in this case, that will be a symbol you can print.

Cheers
Thomas



On 10 January 2017 at 09:51:55, g.maub...@weinwolf.de 
(g.maub...@weinwolf.de(mailto:g.maub...@weinwolf.de)) wrote:

> Hi All,
>  
> I have a function like
>  
> my_func <- function(dataset)
> {
> some operation
> }
>  
> Now I would like not only to operate on the dataset (how this is done is
> obvious) but I would like to get the name of the dataset handed over as an
> argument.
>  
> Example:
>  
> my_func <- function(dataset = iris)
> {
> print(dataset) # here I do not want to print the dataset but the name
> of the object - iris in this case - instead
> # quote() does not do the trick cause it prints "dataset" instead of
> "iris"
> # as.name() gives an error saying that the object can not coerced to a
> symbol
> }
>  
> Is there a way to do this?
>  
> Kind regards
>  
> Georg
>  
> __
> 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] Assessing the name of an object within an argument

2017-01-10 Thread G . Maubach
Hi All,

I have a function like

my_func <- function(dataset)
{
  some operation
}

Now I would like not only to operate on the dataset (how this is done is 
obvious) but I would like to get the name of the dataset handed over as an 
argument.

Example:

my_func <- function(dataset = iris)
{
  print(dataset)  # here I do not want to print the dataset but the name 
of the object - iris in this case - instead
  # quote() does not do the trick cause it prints "dataset" instead of 
"iris"
  # as.name() gives an error saying that the object can not coerced to a 
symbol
}

Is there a way to do this?

Kind regards

Georg

__
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] Asignar número de semana

2017-01-10 Thread miguel.angel.rodriguez.muinos
Hola Rubén.

El tema de trabajar con fechas no es nada trivial y tiene su importancia.

Cuándo empieza una semana y/o cuál es la primera semana del año (por
ejemplo) son aspectos que hay que tener bien definidos a la hora de
trabajar con fechas.

Te recomiendo que le eches un ojo a la norma ISO 8601, que arroja
bastante luz sobre este asunto.
https://es.wikipedia.org/wiki/ISO_8601
http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=40874

En R hay bastante material al respecto (por darte una referencia, el
paquete ISOweek y similares).

Desde mi punto de vista, el quiz de la cuestión esta en la función
as.Date() y el parámetro "format". Yo empezaría por ahí.

Por ponerte un ejemplo concreto, te comentaré como he resuelto el
cálculo de la semana epidemiológica:
Para no liarte con definiciones simplemente has de saber que, en la
práctica, la primera semana epidemiológica de un año es aquella que
contiene el primer jueves de ese año. Partiendo de esa premisa es
sencillo realizar una función que calcule el número de la semana
epidemiológica de una fecha dada

# Cálculo de la semana Epidemiológica (semepi)
 fecha=as.Date(datos.$fecha,format="%d/%m/%Y")
 diafecha=as.numeric(format(fecha,format="%w"))
 diferencia=4-diafecha
 Jueves=fecha+diferencia
 if (diferencia<4)
{
semepi=ceiling(as.numeric(format(Jueves,format="%j"))/7)
} else semepi=ceiling(as.numeric(format(Jueves,format="%j"))/7)-1
 if (semepi==0)
semepi=ceiling(as.numeric(format(Jueves-7,format="%j"))/7)
 semepi
# FIN

Si modificas esto según tus necesidades, puedes calcular la semana en
función del día que te interese que creo que es tu caso.

Un saludo,

--
Miguel Ángel Rodríguez Muíños
Asesoramento en Informática
Dirección Xeral de Saúde Pública
Consellería de Sanidade
Xunta de Galicia
http://dxsp.sergas.es



El 09/01/2017 a las 22:51, Rubén Coca escribió:
> Hola a todos.
> Estoy tratando de asignar el número de semana del año a una serie de fechas
> y me encuentro con que el paquete lubridate considera como día de inicio de
> la semana el domingo en lugar del lunes.
> Lo que se me ha ocurrido es crear una tabla auxiliar de fechas con los
> campos: 'Fecha desde', 'Fecha hasta' y 'Semana ISO' tal que así:
> 'Fecha desde', 'Fecha hasta', 'Semana ISO'
> 28/12/2015, 03/01/2016, 53
> 04/01/2016, 10/01/2016, 1
> 11/01/2016, 17/01/2016, 2
> 18/01/2016, 24/01/2016, 3
> Pero lo que es muy fácil con Excel (=buscarv(fecha;tabla;3;1)), con R no sé
> como hacerlo.
>
> ¿Alguna idea, sugerencia o forma alternativa de encarar el problema?
>
> Gracias por vuestra ayuda.
> Rubé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




Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso-confidencialidad

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