[R] Error In DESeq installation

2016-10-23 Thread Yogesh Gupta
Dear All,

I am getting error in DESeq installation in R.

package ‘DESeq’ is not available (for R version 3.3.1)
> source("http://www.Bioconductor.org/biocLite.R;)
Bioconductor version 3.4 (BiocInstaller 1.24.0), ?biocLite for help
> biocLite("BiocUpgrade")
Error: Bioconductor version 3.4 cannot be upgraded with R version 3.3.1

Can you suggest me I How I can resolve it.

Thanks
Yogesh


*Yogesh Gupta*
*Postdoctoral Researcher*
*Department of Biological Science*
*Seoul National University*
*Seoul, South Korea*
web) http://biosci.snu.ac.kr/jiyounglee
*Cell No. +82-10-6453-0716*

[[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] Using with() to avoid $ ?

2016-10-23 Thread William Dunlap via R-help
Here is a concrete example where with(data, fit(formula)) differs from
fit(formula, data):

> z1 <- function(myFormula, myData) lm(myFormula, data=myData)
> z2 <- function(myFormula, myData) with(myData, lm(myFormula))
> coef(z1(hp ~ wt, datasets::mtcars))
(Intercept)  wt
  -1.820922   46.160050
> coef(z2(hp ~ wt, datasets::mtcars))
Error in eval(expr, envir, enclos) : object 'hp' not found

You could fix this up by adding data=environment() to z2's call to lm,
but I suspect there are lots of other functions for which this would fail
to work correctly.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Sun, Oct 23, 2016 at 9:18 AM, Bert Gunter  wrote:

> As has been noted oftimes on this list
> f( y ~ x1 + x2 + x3 + ... , data = foo,  ...)
>
> is much preferable to
> f( foo$y ~ foo$x1 + foo$x2 + foo$x3 + ...,  ...)
>
> (with no data argument), using nse = non-standard evaluation to set the
> environment for formula evaluation. However, as queries here recently
> demonstrate,  the formula variables (y, x1, x2, x3, ...) or other variables
> in foo are also sometimes needed as further arguments of f,  and these have
> to be explicitly and tediously given as foo$whatever or equivalent
> indexing.
>
> So my question is, can/should with() be used instead in the form
> with(foo, f( y ~ x1 + x2 + x3 + ... , data = foo,  ...))  with no explicit
> $ or indexing in ... variables?
>
> or even
> with(foo, f( y ~ x1 + x2 + x3 + ... ,  ...))
>
> with no data argument for nse or indexing, though this seems to me
> questionable in that it may affect the formula's  environment
> differently.(??)
>
> Please correct any misstatements of fact in the above as well as clarifying
> anything else I seem confused about.
>
> Many thanks.
>
> Bert
>
> [[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] Using with() to avoid $ ?

2016-10-23 Thread Duncan Murdoch

On 23/10/2016 3:43 PM, Bert Gunter wrote:

Yes, variables in the formula should be handled by nse with the data
argument. Got it -- thanks. But still ... can with() be used to handle
those and/or any other variables in foo that appear as arguments. I see no
problems in doing so, but ... ?


One possible problem:

Formulas aren't just the bits you can see, they have environments 
attached.  The NSE part of evaluating them makes sure that the 
environment contains the variables in the data argument early in the chain.


This means that your function can pass the evaluated formula to another 
function, and it will carry the appropriate data with it.


If you evaluate a formula within with(), things will get complicated. 
The environment attached to the formula in


with(foo, f( y ~ x1 + x2 + x3 + ... , data = foo,  ...))

will likely contain two different copies of the variables in foo.  The 
first will be the usual one described above.  But since formulas can 
refer to things in the environment that called f(), it is added to the 
chain of environments that are the parent of the first one.


Environments are reference objects, so f() could decide to modify some 
of the variables.  It would likely get very confused if there were two 
copies of them, one in one environment, one in another.


So I'd advise to use one form or the other, i.e. don't use with(), or if 
you do, don't use data=.


Duncan Murdoch



Bert

(But see inline below)

On Oct 23, 2016 7:24 PM, "Jeff Newmiller"  wrote:


No. And I don't know why you are conflating the treatment of variables in

the formula with treatment of variables passed as other arguments. It is
sort of like thinking the x symbols in foo$x[ x < 0 ] refer to the same
data.

In my query they explicitly do, though. Nevertheless your response was
apropos.



foo$y ~ foo$x1 + foo$x2 + foo$x3 is not preferable, and given the

availability of a data argument such redundancy is unnecessary. NSE is
already in use for the formula. It is not (necessarily) in use for the
other arguments, so you just have to learn which arguments are being
handled with NSE by any particular function and which are not... good docs
would be the preferred avenue but recognizing the error message that arises
when you fail to specify foo$ for the non-formula arguments gets me by if
the docs are unclear.


However, it is dangerous to apply NSE tricks recursively, so piling

"with" on top of the existing formula eval-with-data is only likely to
confuse the evaluation context even more.

This is what I'm not sure of. Can you give an example of when such
confusion would occur?




--
Sent from my phone. Please excuse my brevity.

On October 23, 2016 9:18:17 AM PDT, Bert Gunter 

wrote:

As has been noted oftimes on this list
f( y ~ x1 + x2 + x3 + ... , data = foo,  ...)

is much preferable to
f( foo$y ~ foo$x1 + foo$x2 + foo$x3 + ...,  ...)

(with no data argument), using nse = non-standard evaluation to set the
environment for formula evaluation. However, as queries here recently
demonstrate,  the formula variables (y, x1, x2, x3, ...) or other
variables
in foo are also sometimes needed as further arguments of f,  and these
have
to be explicitly and tediously given as foo$whatever or equivalent
indexing.

So my question is, can/should with() be used instead in the form
with(foo, f( y ~ x1 + x2 + x3 + ... , data = foo,  ...))  with no
explicit
$ or indexing in ... variables?

or even
with(foo, f( y ~ x1 + x2 + x3 + ... ,  ...))

with no data argument for nse or indexing, though this seems to me
questionable in that it may affect the formula's  environment
differently.(??)

Please correct any misstatements of fact in the above as well as
clarifying
anything else I seem confused about.

Many thanks.

Bert

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



__
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] Significance of Svyrepdesign Object Warning

2016-10-23 Thread Courtney Benjamin
​Thank you for your help.  I did try Anthony's recommendation of removing the 
'na.action=na.exclude' ; I thought I needed that argument as the data set 
includes NA values.  I found it interesting that without the 
'na.action=na.exclude' argument, the baseline level of two of my predictor 
variables (BYINCOME & F1HIMATH) were changed.


Courtney Benjamin

Broome-Tioga BOCES

Automotive Technology II Teacher

Located at Gault Toyota

Doctoral Candidate-Educational Theory & Practice

State University of New York at Binghamton

cbenj...@btboces.org

607-763-8633


From: William Dunlap 
Sent: Sunday, October 23, 2016 2:24 PM
To: Anthony Damico
Cc: Courtney Benjamin; r-help@r-project.org; Thomas Lumley
Subject: Re: [R] Significance of Svyrepdesign Object Warning

The immediate problem could be solved by changing the following lines in 
survey:::summary.svrepglm from
presid <- resid(object, "pearson")
dispersion <- sum(object$survey.design$pweights * presid^2,
na.rm = TRUE)/sum(object$survey.design$pweights)
to
presid <- resid(object, "pearson")
pweights <- naresid(object$na.action, object$survey.design$pweights)
dispersion <- sum(pweights * presid^2, na.rm = TRUE)/sum(pweights,
na.rm = TRUE)

'naresid' uses the information from na.exclude to match up the residuals
with the row in the data that they correspond to.  resid() calls it so it should
also be applied to pweights so they line up correctly.




Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Sun, Oct 23, 2016 at 11:17 AM, Anthony Damico 
> wrote:
hi, great example.  i am ccing survey package author/maintainer dr.
lumley.  why do you have `na.action=na.exclude`?  if you remove it, things
work as expected--


library(RCurl)
library(survey)
data <- getURL("
https://raw.githubusercontent.com/cbenjamin1821/careertech-ed/master/elsq1adj.csv
")
elsq1ch <- read.csv(text = data)
#Specifying the svyrepdesign object which applies the BRR weights
elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type =
"BRR")
elsq1ch_brr
#Logistic regression call which yields a warning regarding svyrepdesign
object

# your warning
a <-
svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude)
summary(a)

# works fine
a <-
svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1==1)
summary(a)



the mismatch of vectors generating that warning happens inside

debug(survey:::summary.svrepglm)

[..snip..]

Browse[2]> length(presid)
[1] 12614
Browse[2]> length(object$survey.design$pweights)
[1] 8397


and including vs excluding the na.action=na.exclude gives you a
slightly different dispersion parameter calculation

(Dispersion parameter for binomial family taken to be 0.7756235)

(Dispersion parameter for binomial family taken to be 0.7849244)


not sure if the two survey:::residuals.sv* methods should 
deal with the
na.action= parameter?


thanks

On Sun, Oct 23, 2016 at 11:56 AM, Courtney Benjamin 
>
wrote:

> Hello R Users,
>
> I am using Lumley's Survey Package in R to analyze complex survey data
> that involves 200 balanced repeated replicate (BRR) weight variables.  I
> have ensured that my svyrepdesign object that specifies the application of
> the BRR weights to the data set is accurate and I have matched the
> published standard errors of the data set.
>
> When doing a logistic regression through the svyglm call, I receive the
> following warning:
>
> In object$survey.design$pweights * presid^2 :
>   longer object length is not a multiple of shorter object length?
> I have search around quite a bit online and have not been able to find any
> good interpretation of its meaning.  I want to be sure that I am not making
> some type of mistake that is causing this warning to be produced.  Any
> advisement is greatly appreciated.
> The following is an MRE that can be pasted into the R console:
> library(RCurl)
> library(survey)
> data <- getURL("https://raw.githubusercontent.com/
> cbenjamin1821/careertech-ed/master/elsq1adj.csv")
> elsq1ch <- read.csv(text = data)
> #Specifying the svyrepdesign object which applies the BRR weights
> elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
> elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type =
> "BRR")
> elsq1ch_brr
> #Logistic regression call which yields a warning regarding svyrepdesign
> object
> svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+
> 

Re: [R] Using with() to avoid $ ?

2016-10-23 Thread Bert Gunter
Yes, variables in the formula should be handled by nse with the data
argument. Got it -- thanks. But still ... can with() be used to handle
those and/or any other variables in foo that appear as arguments. I see no
problems in doing so, but ... ?

Bert

(But see inline below)

On Oct 23, 2016 7:24 PM, "Jeff Newmiller"  wrote:
>
> No. And I don't know why you are conflating the treatment of variables in
the formula with treatment of variables passed as other arguments. It is
sort of like thinking the x symbols in foo$x[ x < 0 ] refer to the same
data.

In my query they explicitly do, though. Nevertheless your response was
apropos.

>
> foo$y ~ foo$x1 + foo$x2 + foo$x3 is not preferable, and given the
availability of a data argument such redundancy is unnecessary. NSE is
already in use for the formula. It is not (necessarily) in use for the
other arguments, so you just have to learn which arguments are being
handled with NSE by any particular function and which are not... good docs
would be the preferred avenue but recognizing the error message that arises
when you fail to specify foo$ for the non-formula arguments gets me by if
the docs are unclear.
>
> However, it is dangerous to apply NSE tricks recursively, so piling
"with" on top of the existing formula eval-with-data is only likely to
confuse the evaluation context even more.

This is what I'm not sure of. Can you give an example of when such
confusion would occur?


>
> --
> Sent from my phone. Please excuse my brevity.
>
> On October 23, 2016 9:18:17 AM PDT, Bert Gunter 
wrote:
> >As has been noted oftimes on this list
> >f( y ~ x1 + x2 + x3 + ... , data = foo,  ...)
> >
> >is much preferable to
> >f( foo$y ~ foo$x1 + foo$x2 + foo$x3 + ...,  ...)
> >
> >(with no data argument), using nse = non-standard evaluation to set the
> >environment for formula evaluation. However, as queries here recently
> >demonstrate,  the formula variables (y, x1, x2, x3, ...) or other
> >variables
> >in foo are also sometimes needed as further arguments of f,  and these
> >have
> >to be explicitly and tediously given as foo$whatever or equivalent
> >indexing.
> >
> >So my question is, can/should with() be used instead in the form
> >with(foo, f( y ~ x1 + x2 + x3 + ... , data = foo,  ...))  with no
> >explicit
> >$ or indexing in ... variables?
> >
> >or even
> >with(foo, f( y ~ x1 + x2 + x3 + ... ,  ...))
> >
> >with no data argument for nse or indexing, though this seems to me
> >questionable in that it may affect the formula's  environment
> >differently.(??)
> >
> >Please correct any misstatements of fact in the above as well as
> >clarifying
> >anything else I seem confused about.
> >
> >Many thanks.
> >
> >Bert
> >
> >   [[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] Significance of Svyrepdesign Object Warning

2016-10-23 Thread William Dunlap via R-help
The immediate problem could be solved by changing the following lines in
survey:::summary.svrepglm from
presid <- resid(object, "pearson")
dispersion <- sum(object$survey.design$pweights * presid^2,
na.rm = TRUE)/sum(object$survey.design$pweights)
to
presid <- resid(object, "pearson")
pweights <- naresid(object$na.action, object$survey.design$pweights)
dispersion <- sum(pweights * presid^2, na.rm = TRUE)/sum(pweights,
na.rm = TRUE)

'naresid' uses the information from na.exclude to match up the residuals
with the row in the data that they correspond to.  resid() calls it so it
should
also be applied to pweights so they line up correctly.




Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Sun, Oct 23, 2016 at 11:17 AM, Anthony Damico  wrote:

> hi, great example.  i am ccing survey package author/maintainer dr.
> lumley.  why do you have `na.action=na.exclude`?  if you remove it, things
> work as expected--
>
>
> library(RCurl)
> library(survey)
> data <- getURL("
> https://raw.githubusercontent.com/cbenjamin1821/careertech-
> ed/master/elsq1adj.csv
> ")
> elsq1ch <- read.csv(text = data)
> #Specifying the svyrepdesign object which applies the BRR weights
> elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
> elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type =
> "BRR")
> elsq1ch_brr
> #Logistic regression call which yields a warning regarding svyrepdesign
> object
>
> # your warning
> a <-
> svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+
> F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=
> elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude)
> summary(a)
>
> # works fine
> a <-
> svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+
> F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=
> elsq1ch_brr,subset=BYSCTRL==1==1)
> summary(a)
>
>
>
> the mismatch of vectors generating that warning happens inside
>
> debug(survey:::summary.svrepglm)
>
> [..snip..]
>
> Browse[2]> length(presid)
> [1] 12614
> Browse[2]> length(object$survey.design$pweights)
> [1] 8397
>
>
> and including vs excluding the na.action=na.exclude gives you a
> slightly different dispersion parameter calculation
>
> (Dispersion parameter for binomial family taken to be 0.7756235)
>
> (Dispersion parameter for binomial family taken to be 0.7849244)
>
>
> not sure if the two survey:::residuals.sv* methods should deal with the
> na.action= parameter?
>
>
> thanks
>
> On Sun, Oct 23, 2016 at 11:56 AM, Courtney Benjamin 
> wrote:
>
> > Hello R Users,
> >
> > I am using Lumley's Survey Package in R to analyze complex survey data
> > that involves 200 balanced repeated replicate (BRR) weight variables.  I
> > have ensured that my svyrepdesign object that specifies the application
> of
> > the BRR weights to the data set is accurate and I have matched the
> > published standard errors of the data set.
> >
> > When doing a logistic regression through the svyglm call, I receive the
> > following warning:
> >
> > In object$survey.design$pweights * presid^2 :
> >   longer object length is not a multiple of shorter object length?
> > I have search around quite a bit online and have not been able to find
> any
> > good interpretation of its meaning.  I want to be sure that I am not
> making
> > some type of mistake that is causing this warning to be produced.  Any
> > advisement is greatly appreciated.
> > The following is an MRE that can be pasted into the R console:
> > library(RCurl)
> > library(survey)
> > data <- getURL("https://raw.githubusercontent.com/
> > cbenjamin1821/careertech-ed/master/elsq1adj.csv")
> > elsq1ch <- read.csv(text = data)
> > #Specifying the svyrepdesign object which applies the BRR weights
> > elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
> > elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type =
> > "BRR")
> > elsq1ch_brr
> > #Logistic regression call which yields a warning regarding svyrepdesign
> > object
> > svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+
> > F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=
> > elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude)
> > allCC <- summary(svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+
> > F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",
> > design=elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude))
> > allCC
> >
> > #Session Info
> > #R version 3.3.1 (2016-06-21)
> > #Platform: x86_64-w64-mingw32/x64 (64-bit)
> > #Running under: Windows >= 8 x64 (build 9200)
> >
> > #locale:
> > #  [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> > States.1252
> > #[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> > #[5] LC_TIME=English_United States.1252
> > #attached base packages:
> > #  [1] grid  stats graphics  grDevices utils datasets
> > methods   base
> > 

Re: [R] Significance of Svyrepdesign Object Warning

2016-10-23 Thread Anthony Damico
hi, great example.  i am ccing survey package author/maintainer dr.
lumley.  why do you have `na.action=na.exclude`?  if you remove it, things
work as expected--


library(RCurl)
library(survey)
data <- getURL("
https://raw.githubusercontent.com/cbenjamin1821/careertech-ed/master/elsq1adj.csv
")
elsq1ch <- read.csv(text = data)
#Specifying the svyrepdesign object which applies the BRR weights
elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type =
"BRR")
elsq1ch_brr
#Logistic regression call which yields a warning regarding svyrepdesign
object

# your warning
a <-
svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude)
summary(a)

# works fine
a <-
svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1==1)
summary(a)



the mismatch of vectors generating that warning happens inside

debug(survey:::summary.svrepglm)

[..snip..]

Browse[2]> length(presid)
[1] 12614
Browse[2]> length(object$survey.design$pweights)
[1] 8397


and including vs excluding the na.action=na.exclude gives you a
slightly different dispersion parameter calculation

(Dispersion parameter for binomial family taken to be 0.7756235)

(Dispersion parameter for binomial family taken to be 0.7849244)


not sure if the two survey:::residuals.sv* methods should deal with the
na.action= parameter?


thanks

On Sun, Oct 23, 2016 at 11:56 AM, Courtney Benjamin 
wrote:

> Hello R Users,
>
> I am using Lumley's Survey Package in R to analyze complex survey data
> that involves 200 balanced repeated replicate (BRR) weight variables.  I
> have ensured that my svyrepdesign object that specifies the application of
> the BRR weights to the data set is accurate and I have matched the
> published standard errors of the data set.
>
> When doing a logistic regression through the svyglm call, I receive the
> following warning:
>
> In object$survey.design$pweights * presid^2 :
>   longer object length is not a multiple of shorter object length?
> I have search around quite a bit online and have not been able to find any
> good interpretation of its meaning.  I want to be sure that I am not making
> some type of mistake that is causing this warning to be produced.  Any
> advisement is greatly appreciated.
> The following is an MRE that can be pasted into the R console:
> library(RCurl)
> library(survey)
> data <- getURL("https://raw.githubusercontent.com/
> cbenjamin1821/careertech-ed/master/elsq1adj.csv")
> elsq1ch <- read.csv(text = data)
> #Specifying the svyrepdesign object which applies the BRR weights
> elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
> elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type =
> "BRR")
> elsq1ch_brr
> #Logistic regression call which yields a warning regarding svyrepdesign
> object
> svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+
> F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=
> elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude)
> allCC <- summary(svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+
> F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",
> design=elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude))
> allCC
>
> #Session Info
> #R version 3.3.1 (2016-06-21)
> #Platform: x86_64-w64-mingw32/x64 (64-bit)
> #Running under: Windows >= 8 x64 (build 9200)
>
> #locale:
> #  [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
> #[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> #[5] LC_TIME=English_United States.1252
> #attached base packages:
> #  [1] grid  stats graphics  grDevices utils datasets
> methods   base
> #other attached packages:
> #[1] survey_3.31-2   survival_2.39-4 Matrix_1.2-6RCurl_1.95-4.8
> bitops_1.0-6
> #loaded via a namespace (and not attached):
> #[1] tools_3.3.1 splines_3.3.1   knitr_1.14  lattice_0.20-33
>
>
> Courtney Benjamin
>
> Broome-Tioga BOCES
>
> Automotive Technology II Teacher
>
> Located at Gault Toyota
>
> Doctoral Candidate-Educational Theory & Practice
>
> State University of New York at Binghamton
>
> cbenj...@btboces.org
>
> 607-763-8633
>
> [[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, 

Re: [R] Using with() to avoid $ ?

2016-10-23 Thread Jeff Newmiller
No. And I don't know why you are conflating the treatment of variables in the 
formula with treatment of variables passed as other arguments. It is sort of 
like thinking the x symbols in foo$x[ x < 0 ] refer to the same data. 

foo$y ~ foo$x1 + foo$x2 + foo$x3 is not preferable, and given the availability 
of a data argument such redundancy is unnecessary. NSE is already in use for 
the formula. It is not (necessarily) in use for the other arguments, so you 
just have to learn which arguments are being handled with NSE by any particular 
function and which are not... good docs would be the preferred avenue but 
recognizing the error message that arises when you fail to specify foo$ for the 
non-formula arguments gets me by if the docs are unclear. 

However, it is dangerous to apply NSE tricks recursively, so piling "with" on 
top of the existing formula eval-with-data is only likely to confuse the 
evaluation context even more. 

-- 
Sent from my phone. Please excuse my brevity.

On October 23, 2016 9:18:17 AM PDT, Bert Gunter  wrote:
>As has been noted oftimes on this list
>f( y ~ x1 + x2 + x3 + ... , data = foo,  ...)
>
>is much preferable to
>f( foo$y ~ foo$x1 + foo$x2 + foo$x3 + ...,  ...)
>
>(with no data argument), using nse = non-standard evaluation to set the
>environment for formula evaluation. However, as queries here recently
>demonstrate,  the formula variables (y, x1, x2, x3, ...) or other
>variables
>in foo are also sometimes needed as further arguments of f,  and these
>have
>to be explicitly and tediously given as foo$whatever or equivalent
>indexing.
>
>So my question is, can/should with() be used instead in the form
>with(foo, f( y ~ x1 + x2 + x3 + ... , data = foo,  ...))  with no
>explicit
>$ or indexing in ... variables?
>
>or even
>with(foo, f( y ~ x1 + x2 + x3 + ... ,  ...))
>
>with no data argument for nse or indexing, though this seems to me
>questionable in that it may affect the formula's  environment
>differently.(??)
>
>Please correct any misstatements of fact in the above as well as
>clarifying
>anything else I seem confused about.
>
>Many thanks.
>
>Bert
>
>   [[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] Using with() to avoid $ ?

2016-10-23 Thread Bert Gunter
As has been noted oftimes on this list
f( y ~ x1 + x2 + x3 + ... , data = foo,  ...)

is much preferable to
f( foo$y ~ foo$x1 + foo$x2 + foo$x3 + ...,  ...)

(with no data argument), using nse = non-standard evaluation to set the
environment for formula evaluation. However, as queries here recently
demonstrate,  the formula variables (y, x1, x2, x3, ...) or other variables
in foo are also sometimes needed as further arguments of f,  and these have
to be explicitly and tediously given as foo$whatever or equivalent indexing.

So my question is, can/should with() be used instead in the form
with(foo, f( y ~ x1 + x2 + x3 + ... , data = foo,  ...))  with no explicit
$ or indexing in ... variables?

or even
with(foo, f( y ~ x1 + x2 + x3 + ... ,  ...))

with no data argument for nse or indexing, though this seems to me
questionable in that it may affect the formula's  environment
differently.(??)

Please correct any misstatements of fact in the above as well as clarifying
anything else I seem confused about.

Many thanks.

Bert

[[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] Significance of Svyrepdesign Object Warning

2016-10-23 Thread Courtney Benjamin
Hello R Users,

I am using Lumley's Survey Package in R to analyze complex survey data that 
involves 200 balanced repeated replicate (BRR) weight variables.  I have 
ensured that my svyrepdesign object that specifies the application of the BRR 
weights to the data set is accurate and I have matched the published standard 
errors of the data set.

When doing a logistic regression through the svyglm call, I receive the 
following warning:

In object$survey.design$pweights * presid^2 :
  longer object length is not a multiple of shorter object length?
I have search around quite a bit online and have not been able to find any good 
interpretation of its meaning.  I want to be sure that I am not making some 
type of mistake that is causing this warning to be produced.  Any advisement is 
greatly appreciated.
The following is an MRE that can be pasted into the R console:
library(RCurl)
library(survey)
data <- 
getURL("https://raw.githubusercontent.com/cbenjamin1821/careertech-ed/master/elsq1adj.csv;)
elsq1ch <- read.csv(text = data)
#Specifying the svyrepdesign object which applies the BRR weights
elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights = 
elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type = "BRR")
elsq1ch_brr
#Logistic regression call which yields a warning regarding svyrepdesign object
svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude)
allCC <- 
summary(svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1==1,na.action=na.exclude))
allCC

#Session Info
#R version 3.3.1 (2016-06-21)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows >= 8 x64 (build 9200)

#locale:
#  [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United 
States.1252
#[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
#[5] LC_TIME=English_United States.1252
#attached base packages:
#  [1] grid  stats graphics  grDevices utils datasets  methods   
base
#other attached packages:
#[1] survey_3.31-2   survival_2.39-4 Matrix_1.2-6RCurl_1.95-4.8  
bitops_1.0-6
#loaded via a namespace (and not attached):
#[1] tools_3.3.1 splines_3.3.1   knitr_1.14  lattice_0.20-33


Courtney Benjamin

Broome-Tioga BOCES

Automotive Technology II Teacher

Located at Gault Toyota

Doctoral Candidate-Educational Theory & Practice

State University of New York at Binghamton

cbenj...@btboces.org

607-763-8633

[[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] gtools Gator infected...

2016-10-23 Thread Troels Ring
I have informed the vendor that perhaps spyhunter 4 is too aggressive. 
They suggested I could make an exclusion - but it turned out to be not 
looking for Gator rather than not looking in gtools.dll. I shall inform 
if anything appears


BW

Troels


Den 23-10-2016 kl. 11:57 skrev Mateusz Kopyt:
One of my student also noticed such report (about Gator) from 
Spyhunter. We have checked that the file on the computer is identical 
to this from repo.
So probably it was a false alarm. If you have some information from 
enigmasoftware, please share on the list.


Best regards
Mateusz Kopyt
WNE UW, Poland

W dniu 22.10.2016 o 13:31, Troels Ring pisze:
Thanks a lot - I have asked enigmasoftware to go and check up on this 
- and they'll also see your letter!


BW
Troels


Den 22-10-2016 kl. 13:12 skrev Bob Rudis:

I think your tool is a bit overzealous. VirusTotal -
https://virustotal.com/en/file/5fd1b2fc5c061c0836a70cbad620893a89a27d9251358a5c42c3e49113c9456c/analysis/ 

& 
https://virustotal.com/en/file/e133ebf5001e1e991f1f6b425adcfbab170fe3c02656e3a697a5ebea961e909c/analysis/

- shows no sign of any malware in the 32-bit DLLor 64-bit DLL (I
tested  r-release: gtools_3.5.0.zip)

On Sat, Oct 22, 2016 at 4:50 AM, Troels Ring  wrote:
Hi friends - just installed gtools to make rstan run. Was rapidly 
informed

by Spyhunter 4 that gtools.dll harboured Gator. Spyhunter 4 then
aggressively removed Gator - and gtools were gone and rstan out of 
function.

Kind of sorry about this.

Best wishes

Troels Ring

Aalborg, Denmark

__
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
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] gtools Gator infected...

2016-10-23 Thread Mateusz Kopyt
One of my student also noticed such report (about Gator) from Spyhunter. 
We have checked that the file on the computer is identical to this from 
repo.
So probably it was a false alarm. If you have some information from 
enigmasoftware, please share on the list.


Best regards
Mateusz Kopyt
WNE UW, Poland

W dniu 22.10.2016 o 13:31, Troels Ring pisze:
Thanks a lot - I have asked enigmasoftware to go and check up on this 
- and they'll also see your letter!


BW
Troels


Den 22-10-2016 kl. 13:12 skrev Bob Rudis:

I think your tool is a bit overzealous. VirusTotal -
https://virustotal.com/en/file/5fd1b2fc5c061c0836a70cbad620893a89a27d9251358a5c42c3e49113c9456c/analysis/ 

& 
https://virustotal.com/en/file/e133ebf5001e1e991f1f6b425adcfbab170fe3c02656e3a697a5ebea961e909c/analysis/

- shows no sign of any malware in the 32-bit DLLor 64-bit DLL (I
tested  r-release: gtools_3.5.0.zip)

On Sat, Oct 22, 2016 at 4:50 AM, Troels Ring  wrote:
Hi friends - just installed gtools to make rstan run. Was rapidly 
informed

by Spyhunter 4 that gtools.dll harboured Gator. Spyhunter 4 then
aggressively removed Gator - and gtools were gone and rstan out of 
function.

Kind of sorry about this.

Best wishes

Troels Ring

Aalborg, Denmark

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


Re: [R] About reshape dataset

2016-10-23 Thread P Tennant
You could convert your data from a wide format to a long format using 
the reshape function in base R:


DF2 <- reshape(DF, direction="long",
idvar=names(DF)[1:3],
varying=c("site1_elev", "site1_temp", "site2_elev", "site2_temp"),
v.names=c("elev", "temp"),
times=1:2,
timevar = "siteID")

rownames(DF2) <- NULL
DF2

  year month day siteID elev temp
1 2000 5   6  1 1300   20
2 2000 5   7  1 1300   21
3 2000 5   8  1 1300   19
4 2000 5   9  1 1300   22
5 2000 5   6  2 1500   21
6 2000 5   7  2 1500   22
7 2000 5   8  2 1500   20
8 2000 5   9  2 1500   23

Philip


On 23/10/2016 4:50 AM, lily li wrote:

Hi R users,

I want to melt a dataframe, but it mixed up the variables.

DF is the original dataset:
year  month  day  site1_elev  site2_elev  site1_temp  site2_temp
2000 561300  150020  21

2000 571300  150021  22
2000 581300  150019  20
2000 591300  150022  23

How to melt the dataframe and get the following dataset? Thanks for your
help.

year  month  day  siteID   elev   temp
20005 6   1  130020
20005 6   2  150021
20005 7   1  130021
20005 7   2  150022

[[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] nls.lm

2016-10-23 Thread Mike meyer
Please accept my apologies as I was in fact wrong.

It was not my intention to attack minpack.lm or criticize the maintainer.
I like minpack.lm and am fully aware of the effort involved in rewriting the
code. Next time I'll use more careful wording.

Thanks also to Professor Nash for his efforts. I look forward to the results.


Best regards,

Michael
unaffiliatd




> Gesendet: Freitag, 21. Oktober 2016 um 09:39 Uhr
> Von: "Berend Hasselman" 
> An: "Mike meyer" <1101...@gmx.net>
> Cc: ProfJCNash , "r-help@r-project.org" 
> 
> Betreff: Re: [R] nls.lm
>
> 
> > On 21 Oct 2016, at 06:00, Mike meyer <1101...@gmx.net> wrote:
> > 
> > Let's take a different view of the problem.
> > Given f=(f_1,...,f_m):R^n -> R^m we want to minimize ||f(x)||.
> > 
> > What distinguishes this from a general minimization problem is that you 
> > know the structure of the
> > objective function F(x)=||f(x)||² and have the individual constituents f_j.
> > Make use of that information as appropriate.
> > 
> > This is more general than trying to solve the system f(x)=0 or fitting a 
> > model to data.
> > In this more general setting notions such as underdetermined/overdetermined 
> > system do not apply.
> > 
> > The restricted view of model fitting serves only to confuse the issue.
> > For that reason it is (in my view) a bad idea to force the user to set up 
> > his problem in 
> > R-model notation.
> > 
> 
> I assume that you have been referring to the R package minpack.lm.
> 
> I've had a look at the underlying Fortran code (from Minpack and developed by 
> More et.al.  made in a distant past) as used by the package.
> That underlying code returns an error when the condition:  number of 
> functions (m)  >=  the number of independent variables (n)
> is not satisfied i.e. when m < n.
> 
> Making that more general would entail a lot of thinking and reworking of the 
> code. As far as I can see it is not possible to just remove the condition 
> m>=n from the underlying Fortran. More (possibly many) changes would be 
> required. Blaming R and/or the package author/maintainer is unfair.
> 
> If you require a more general version of the algorithm or if you want 
> something else you will have to roll your own package/code.
> If you don't feel that minpack.lm is appropriate for your application and you 
> want changes you'll have to discuss matters with Moré 
> (http://www.mcs.anl.gov/~more/) if I got the correct link.
> 
> Berend
> 
>

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