[R] dont remenber my password

2014-08-29 Thread Ernesto Villarino


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] what 's meaning of setting options() through .onLoad() funtion in making a package?

2014-08-29 Thread PO SU

Dear expeRts,
   I am now reading a book which teaching how to make  a  r package, i 
investigated from ?options but nothing said about in making a package. The help 
document only just introduce some option keys to me in some basic r packages.
  But i want to know, why need to  set some options in make a r package, e.g.
  If i use options(a=3) in my package, what's usage of a ?


The following code is from Hadley wickham's book , i attach it for your better 
understanding my quesion:


.onLoad <- function(libname, pkgname) {
op <- options()
op.devtools <- list(
devtools.path = "~/R-dev",
devtools.install.args = "",
devtools.name = "Your name goes here",
devtools.desc.author = '"First Last  [aut, cre]"',
devtools.desc.license = "What license is it under?",
devtools.desc.suggests = NULL,
devtools.desc = list()
)
toset <- !(names(op.devtools) %in% names(op))
if(any(toset)) options(op.devtools[toset])
invisible()
}

--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU
__
R-help@r-project.org mailing list
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] HANDLER FUNCTION PROBLEM

2014-08-29 Thread Ashis Deb
Hello   ,



I  have  a  function  handler  using  gWidgets like  below   ,,  i  had
declared  a  function  inside  this   function   .   But  dont  have  the
idea  how   to  call   the  function  outside  the  handler   function.



 addHandlerClicked(AAS,handler=function(h,...)
  {

ga()<<<  THIS  IS THE  FUNCTION  TO  BE
CALLED  OUTSIDE

{

}


})


ga()   <<---WANTED  IT  OUTSIDE



  can  anyone  help  please

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Question regarding the discrepancy between count model parameter estimates between "pscl" and "MASS"

2014-08-29 Thread peter dalgaard
I'm no expert on hurdle models, but it seems that you are unaware that the 
negative binomial and the truncated negative binomial are quite different 
things.

-pd


On 29 Aug 2014, at 05:57 , Nick Livingston  wrote:

> I have sought consultation online and in person, to no avail. I hope someone
> on here might have some insight. Any feedback would be most welcome.
> 
> I am attempting to plot predicted values from a two-component hurdle model
> (logistic [suicide attempt yes/no] and negative binomial count [number of
> attempts thereafter]). To do so, I estimated each component separately using
> glm (MASS). While I am able to reproduce hurdle results for the logit
> portion in glm, estimates for the negative binomial count component are
> different.
> 
> Call:
> hurdle(formula = Suicide. ~ Age + gender + Victimization * FamilySupport |
> Age + gender + Victimization * FamilySupport, dist = "negbin", link =
> "logit")
> 
> Pearson residuals:
> Min  1Q  Median  3Q Max
> -0.9816 -0.5187 -0.4094  0.2974  5.8820
> 
> Count model coefficients (truncated negbin with log link):
> Estimate Std. Error z value
> Pr(>|z|)   
> (Intercept)  -0.291500.33127  -0.880   0.3789   
> Age  0.170680.07556   2.259   0.0239
> *
> gender 0.282730.31614   0.894   0.3712   
> Victimization 1.084050.18157   5.971 2.36e-09
> ***
> FamilySupport  0.336290.29302   1.148   0.2511   
> Victimization:FamilySupport -0.968310.46841  -2.067   0.0387 *
> Log(theta)0.122450.54102   0.226   0.8209   
> Zero hurdle model coefficients (binomial with logit link):
>  Estimate Std. Error z value
> Pr(>|z|)   
> (Intercept)   -0.547051   0.215981  -2.533  0.01131
> *
> Age -0.154493   0.063994  -2.414
> 0.01577 *
> gender -0.030942   0.284868  -0.109  0.91350  
>
> Victimization  1.073956   0.338015   3.177  0.00149
> **
> FamilySupport   -0.380360   0.247530  -1.537  0.12439   
> Victimization\:FamilySupport  -0.813329   0.399905  -2.034  0.04197 *
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> Theta: count = 1.1303
> Number of iterations in BFGS optimization: 23
> Log-likelihood: -374.3 on 25 Df
>> summary(logistic)
> 
> 
> 
> 
> Call:
> glm(formula = SuicideBinary ~ Age + gender = Victimization * FamilySupport,
> family = "binomial")
> 
> Deviance Residuals:
> Min   1Q   Median   3Q  Max
> -1.9948  -0.8470  -0.6686   1.1160   2.0805
> 
> Coefficients:
>  Estimate Std. Error z value
> Pr(>|z|)   
> (Intercept)  -0.547051   0.215981  -2.533  0.01131 *
> Age-0.154493   0.063994  -2.414  0.01577
> *
> gender-0.030942   0.284868  -0.109  0.91350   
> Victimization 1.073956   0.338014   3.177  0.00149
> **
> FamilySupport  -0.380360   0.247530  -1.537  0.12439   
> Victimization:FamilySupport  -0.813329   0.399904  -2.034  0.04197 *
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> (Dispersion parameter for binomial family taken to be 1)
> 
> Null deviance: 452.54  on 359  degrees of freedom
> Residual deviance: 408.24  on 348  degrees of freedom
>   (52 observations deleted due to missingness)
> AIC: 432.24
> 
> Number of Fisher Scoring iterations: 4
> 
>> summary(Count1)
> 
> 
> 
> 
> 
> 
> Call:
> glm(formula = NegBinSuicide ~ Age + gender + Victimization * FamilySupport,
> family = negative.binomial(theta = 1.1303))
> 
> Deviance Residuals:
> Min   1Q   Median   3Q  Max
> -1.6393  -0.4504  -0.1679   0.2350   2.1676
> 
> Coefficients:
> Estimate Std. Error t value
> Pr(>|t|)   
> (Intercept)0.608200.13779   4.414 2.49e-05
> ***
> Age  0.088360.04189   2.109   0.0373
> *
> gender  0.109830.17873   0.615   0.5402   
> Victimization  0.732700.10776   6.799 6.82e-10
> ***
> FamilySupport0.102130.15979   0.639   0.5241   
> Victimization:FamilySupport   -0.601460.24532  -2.452   0.0159 *
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> (Dispersion parameter for Negative Binomial(1.1303) family taken to be
> 0.4549082)
> 
> Null deviance: 76.159  on 115  degrees of freedom
> Residual deviance: 35.101  on 104  degrees of freedom
>   (296 observations deleted due to missingness)
> AIC: 480.6
> 
> Number of Fi

Re: [R] Question regarding the discrepancy between count model parameter estimates between "pscl" and "MASS"

2014-08-29 Thread Achim Zeileis

On Fri, 29 Aug 2014, peter dalgaard wrote:

I'm no expert on hurdle models, but it seems that you are unaware that 
the negative binomial and the truncated negative binomial are quite 
different things.


Yes. You can replicate the truncated count part of the hurdle model with 
the zerotrunc() function from the "countreg" package. The package is not 
yet on CRAN but can be easily installed from R-Forge.



-pd


On 29 Aug 2014, at 05:57 , Nick Livingston  wrote:


I have sought consultation online and in person, to no avail. I hope someone
on here might have some insight. Any feedback would be most welcome.

I am attempting to plot predicted values from a two-component hurdle model
(logistic [suicide attempt yes/no] and negative binomial count [number of
attempts thereafter]). To do so, I estimated each component separately using
glm (MASS). While I am able to reproduce hurdle results for the logit
portion in glm, estimates for the negative binomial count component are
different.

Call:
hurdle(formula = Suicide. ~ Age + gender + Victimization * FamilySupport |
Age + gender + Victimization * FamilySupport, dist = "negbin", link =
"logit")

Pearson residuals:
Min  1Q  Median  3Q Max
-0.9816 -0.5187 -0.4094  0.2974  5.8820

Count model coefficients (truncated negbin with log link):
Estimate Std. Error z value
Pr(>|z|)
(Intercept)  -0.291500.33127  -0.880   0.3789
Age  0.170680.07556   2.259   0.0239
*
gender 0.282730.31614   0.894   0.3712
Victimization 1.084050.18157   5.971 2.36e-09
***
FamilySupport  0.336290.29302   1.148   0.2511
Victimization:FamilySupport -0.968310.46841  -2.067   0.0387 *
Log(theta)0.122450.54102   0.226   0.8209
Zero hurdle model coefficients (binomial with logit link):
 Estimate Std. Error z value
Pr(>|z|)
(Intercept)   -0.547051   0.215981  -2.533  0.01131
*
Age -0.154493   0.063994  -2.414
0.01577 *
gender -0.030942   0.284868  -0.109  0.91350
Victimization  1.073956   0.338015   3.177  0.00149
**
FamilySupport   -0.380360   0.247530  -1.537  0.12439
Victimization\:FamilySupport  -0.813329   0.399905  -2.034  0.04197 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Theta: count = 1.1303
Number of iterations in BFGS optimization: 23
Log-likelihood: -374.3 on 25 Df

summary(logistic)





Call:
glm(formula = SuicideBinary ~ Age + gender = Victimization * FamilySupport,
family = "binomial")

Deviance Residuals:
Min   1Q   Median   3Q  Max
-1.9948  -0.8470  -0.6686   1.1160   2.0805

Coefficients:
 Estimate Std. Error z value
Pr(>|z|)
(Intercept)  -0.547051   0.215981  -2.533  0.01131 *
Age-0.154493   0.063994  -2.414  0.01577
*
gender-0.030942   0.284868  -0.109  0.91350
Victimization 1.073956   0.338014   3.177  0.00149
**
FamilySupport  -0.380360   0.247530  -1.537  0.12439
Victimization:FamilySupport  -0.813329   0.399904  -2.034  0.04197 *
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 452.54  on 359  degrees of freedom
Residual deviance: 408.24  on 348  degrees of freedom
  (52 observations deleted due to missingness)
AIC: 432.24

Number of Fisher Scoring iterations: 4


summary(Count1)







Call:
glm(formula = NegBinSuicide ~ Age + gender + Victimization * FamilySupport,
family = negative.binomial(theta = 1.1303))

Deviance Residuals:
Min   1Q   Median   3Q  Max
-1.6393  -0.4504  -0.1679   0.2350   2.1676

Coefficients:
Estimate Std. Error t value
Pr(>|t|)
(Intercept)0.608200.13779   4.414 2.49e-05
***
Age  0.088360.04189   2.109   0.0373
*
gender  0.109830.17873   0.615   0.5402
Victimization  0.732700.10776   6.799 6.82e-10
***
FamilySupport0.102130.15979   0.639   0.5241
Victimization:FamilySupport   -0.601460.24532  -2.452   0.0159 *
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

(Dispersion parameter for Negative Binomial(1.1303) family taken to be
0.4549082)

Null deviance: 76.159  on 115  degrees of freedom
Residual deviance: 35.101  on 104  degrees of freedom
  (296 observations deleted due to missingness)
AIC: 480.6

Number of Fisher Scoring iterations: 15


Alternative

[R] Unexpected behavior when giving a value to a new variable based on the value of another variable

2014-08-29 Thread Angel Rodriguez

Dear subscribers,

I've found that if there is a variable in the dataframe with a name very 
similar to a new variable, R does not give the correct values to this latter 
variable based on the values of a third value:


> M <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58)),.Names = 
> c("age"), row.names = c(NA, -9L), 
+class = "data.frame")
> M$sample[M$age >= 65] <- 1 
> M
  age sample
1  67  1
2  62 NA
3  74  1
4  61 NA
5  60 NA
6  55 NA
7  60 NA
8  59 NA
9  58 NA
> N <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58), V2 = c(NA, 1, 
> 1, 1, 1,1,1,1,NA)), 
+ .Names = c("age","samplem"), row.names = c(NA, -9L), 
class = "data.frame")
> N$sample[N$age >= 65] <- 1 
> N
  age samplem sample
1  67  NA  1
2  62   1  1
3  74   1  1
4  61   1  1
5  60   1  1
6  55   1  1
7  60   1  1
8  59   1  1
9  58  NA NA



Any clue for this behavior?



My specifications:

R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252
LC_MONETARY=Spanish_Spain.1252
[4] LC_NUMERIC=C   LC_TIME=Spanish_Spain.1252

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

other attached packages:
[1] foreign_0.8-61

loaded via a namespace (and not attached):
[1] tools_3.1.1




Thank you very much.

Angel Rodriguez-Laso
Research project manager
Matia Instituto Gerontologico


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Conjoint Package

2014-08-29 Thread Vik Rubenfeld
I’m very glad to see the Conjoint Package for R. The documentation for it does 
not appear to specify methods for data acquisition. Are the cards to be 
individually scored by each respondent (most clients would rather see a 
choice-based methodology)?

SurveyGizmo, an excellent online survey host which I use, has in beta a 
Conjoint question type. However, it does not appear to calculate 
respondent-level utility values at this time. 

SurveyGizmo supports a conjoint question design in which each respondent is 
shown 3 cards at a time, and permitted to identify one of the three as Best, 
and one as Worst. (SG supports additional conjoint question designs as well).

Data acquired by SurveyGizmo conjoint looks like this for each respondent:

> Set #1
> Model Attribute   Model Value
> Price $300
> Size  7"
> Memory128 gb
> Score:50
> 
> Set #2
> Model Attribute   Model Value
> Price $100
> Size  4"
> Memory16 gb
> Score:0
> 
> Set #3
> Model Attribute   Model Value
> Price $200
> Size  6"
> Memory64 gb
> Score:100
> 
> Set #4
> Model Attribute   Model Value
> Price $100
> Size  5"
> Memory32 gb
> Score:100
> 
> Set #5
> Model Attribute   Model Value
> Price $200
> Size  5"
> Memory32 gb
> Score:0

Score 100 = Best 
Score 50 = Not selected
Score 0 = Worst

Is it possible to use R-Project Conjoint Package with such a data file, to 
calculate respondent-level utility values?

Thanks very much in advance to all for any info!

Best,


-Vik
__
R-help@r-project.org mailing list
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] R-tool - OS compatibility help

2014-08-29 Thread Ravi Kumar Rupakula
Dear Support,

Please let us know Windows 2008R2 OS compatibility for "R" tool is available or 
not?
If available, please let us know the details.
--
RaviKumar Rupakula | HP: +65-98537306 | Email: 
r...@websynergies.biz | Web Synergies (S) Pte Ltd


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Unexpected behavior when giving a value to a new variable based on the value of another variable

2014-08-29 Thread jim holtman
You are being bitten by the "partial matching" of the "$" operator
(see  ?"$" for a better explanation).  Here is solution that works:


**original**
> N <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58), V2 = c(NA, 1, 
> 1, 1, 1,1,1,1,NA)),
+ .Names = c("age","samplem"), row.names = c(NA,
-9L), class = "data.frame")
> N$sample[N$age >= 65] <- 1
> N
  age samplem sample
1  67  NA  1
2  62   1  1
3  74   1  1
4  61   1  1
5  60   1  1
6  55   1  1
7  60   1  1
8  59   1  1
9  58  NA NA
>
>
> N <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58), V2 = c(NA, 1, 
> 1, 1, 1,1,1,1,NA)),
+ .Names = c("age","samplem"), row.names = c(NA,
-9L), class = "data.frame")
> N[["sample"]][N$age >= 65] <- 1  # use the '[[' operation for complete 
> matching
> N
  age samplem sample
1  67  NA  1
2  62   1 NA
3  74   1  1
4  61   1 NA
5  60   1 NA
6  55   1 NA
7  60   1 NA
8  59   1 NA
9  58  NA NA

Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Fri, Aug 29, 2014 at 4:53 AM, Angel Rodriguez
 wrote:
>
> Dear subscribers,
>
> I've found that if there is a variable in the dataframe with a name very 
> similar to a new variable, R does not give the correct values to this latter 
> variable based on the values of a third value:
>
>
>> M <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58)),.Names = 
>> c("age"), row.names = c(NA, -9L),
> +class = "data.frame")
>> M$sample[M$age >= 65] <- 1
>> M
>   age sample
> 1  67  1
> 2  62 NA
> 3  74  1
> 4  61 NA
> 5  60 NA
> 6  55 NA
> 7  60 NA
> 8  59 NA
> 9  58 NA
>> N <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58), V2 = c(NA, 
>> 1, 1, 1, 1,1,1,1,NA)),
> + .Names = c("age","samplem"), row.names = c(NA, -9L), 
> class = "data.frame")
>> N$sample[N$age >= 65] <- 1
>> N
>   age samplem sample
> 1  67  NA  1
> 2  62   1  1
> 3  74   1  1
> 4  61   1  1
> 5  60   1  1
> 6  55   1  1
> 7  60   1  1
> 8  59   1  1
> 9  58  NA NA
>
>
>
> Any clue for this behavior?
>
>
>
> My specifications:
>
> R version 3.1.1 (2014-07-10)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252
> LC_MONETARY=Spanish_Spain.1252
> [4] LC_NUMERIC=C   LC_TIME=Spanish_Spain.1252
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] foreign_0.8-61
>
> loaded via a namespace (and not attached):
> [1] tools_3.1.1
>
>
>
>
> Thank you very much.
>
> Angel Rodriguez-Laso
> Research project manager
> Matia Instituto Gerontologico
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> 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
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] Unexpected behavior when giving a value to a new variable based on the value of another variable

2014-08-29 Thread John McKown
On Fri, Aug 29, 2014 at 3:53 AM, Angel Rodriguez
 wrote:
>
> Dear subscribers,
>
> I've found that if there is a variable in the dataframe with a name very 
> similar to a new variable, R does not give the correct values to this latter 
> variable based on the values of a third value:
>
>

>
> Any clue for this behavior?
>

>
> Thank you very much.
>
> Angel Rodriguez-Laso
> Research project manager
> Matia Instituto Gerontologico

That is unusual, but appears to be documented in a section from

?`[`


Character indices

Character indices can in some circumstances be partially matched (see
pmatch) to the names or dimnames of the object being subsetted (but
never for subassignment). Unlike S (Becker et al p. 358)), R never
uses partial matching when extracting by [, and partial matching is
not by default used by [[ (see argument exact).

Thus the default behaviour is to use partial matching only when
extracting from recursive objects (except environments) by $. Even in
that case, warnings can be switched on by
options(warnPartialMatchDollar = TRUE).

Neither empty ("") nor NA indices match any names, not even empty nor
missing names. If any object has no names or appropriate dimnames,
they are taken as all "" and so match nothing.


Note the commend about "partial matching" in the middle paragraph in
the quote above.

-- 
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown

__
R-help@r-project.org mailing list
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] Unexpected behavior when giving a value to a new variable based on the value of another variable

2014-08-29 Thread Jeff Newmiller
One clue is the help file for "$"...

?" $"

In particular there see the discussion of character indices and the "exact" 
argument.

You can also find this discussed in the Introduction to R document that comes 
with the software.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On August 29, 2014 1:53:47 AM PDT, Angel Rodriguez 
 wrote:
>
>Dear subscribers,
>
>I've found that if there is a variable in the dataframe with a name
>very similar to a new variable, R does not give the correct values to
>this latter variable based on the values of a third value:
>
>
>> M <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59,
>58)),.Names = c("age"), row.names = c(NA, -9L), 
>+class = "data.frame")
>> M$sample[M$age >= 65] <- 1 
>> M
>  age sample
>1  67  1
>2  62 NA
>3  74  1
>4  61 NA
>5  60 NA
>6  55 NA
>7  60 NA
>8  59 NA
>9  58 NA
>> N <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58), V2 =
>c(NA, 1, 1, 1, 1,1,1,1,NA)), 
>+ .Names = c("age","samplem"), row.names = c(NA,
>-9L), class = "data.frame")
>> N$sample[N$age >= 65] <- 1 
>> N
>  age samplem sample
>1  67  NA  1
>2  62   1  1
>3  74   1  1
>4  61   1  1
>5  60   1  1
>6  55   1  1
>7  60   1  1
>8  59   1  1
>9  58  NA NA
>
>
>
>Any clue for this behavior?
>
>
>
>My specifications:
>
>R version 3.1.1 (2014-07-10)
>Platform: x86_64-w64-mingw32/x64 (64-bit)
>
>locale:
>[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252   
>LC_MONETARY=Spanish_Spain.1252
>[4] LC_NUMERIC=C   LC_TIME=Spanish_Spain.1252
>
>attached base packages:
>[1] stats graphics  grDevices utils datasets  methods   base   
> 
>
>other attached packages:
>[1] foreign_0.8-61
>
>loaded via a namespace (and not attached):
>[1] tools_3.1.1
>
>
>
>
>Thank you very much.
>
>Angel Rodriguez-Laso
>Research project manager
>Matia Instituto Gerontologico
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list
>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
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 should I do GO enrichment of differential expressed miRNA?

2014-08-29 Thread Martin Morgan

On 08/28/2014 11:47 PM, my1stbox wrote:

Hi all,
First, I carried out GO enrichment to predicted/validated target genes of those 
miRNA using GOstats package. Then I find myself in a dead end. So what is the 
good practice? Is it possible to directly do GO enrichment to miRNAs? Are they 
included in GO database?


The Bioconductor mailing list

  http://bioconductor.org/help/mailing-list/mailform/

is a more appropriate forum for discussion of Bioconductor packages (like 
topGO). It's better to be more specific about what your question / problem is; 
'dead end' might mean that you had technical problems, or that you managed to 
get results but that they were unsatisfactory for some specific reason, or...


Martin


Regards,
Allen
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.




--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
R-help@r-project.org mailing list
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] HANDLER FUNCTION PROBLEM

2014-08-29 Thread Bert Gunter
1, Please post in plain text, not HTML, as requested by the posting guide.

2. R is not C, You define, not declare, functions, whose scope and
availability are then determined appropriately. Where is ga() defined?

3. Have you read an Introduction to R or other R tutorial? If not, do
so before posting further. You need to do due diligence before
requesting help.

4. If you have, read the R Language Definition Ref for details of how
scoping in R is determined. R is a functional type language (like LISP
or Scheme)

5. Functions are fully first class objects and can be returned by
other functions.

Cheers,

Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll




On Fri, Aug 29, 2014 at 2:26 AM, Ashis Deb  wrote:
> Hello   ,
>
>
>
> I  have  a  function  handler  using  gWidgets like  below   ,,  i  had
> declared  a  function  inside  this   function   .   But  dont  have  the
> idea  how   to  call   the  function  outside  the  handler   function.
>
>
>
>  addHandlerClicked(AAS,handler=function(h,...)
>   {
>
> ga()<<<  THIS  IS THE  FUNCTION  TO  BE
> CALLED  OUTSIDE
>
> {
>
> }
>
>
> })
>
>
> ga()   <<---WANTED  IT  OUTSIDE
>
>
>
>   can  anyone  help  please
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> 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
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] distance matrix from metaMDS

2014-08-29 Thread Cara Fiore
Yes I looked at this and I tried metaMDSdist but got an error and for some
reason I didn't try metaMDSredist which seems to be the right thing. So the
main thing I was confused about was what to call dist() on -i.e., getting
the correct ordinal distance, and then if I assume that the NMDS scores are
the coordinates, which I believe they are, then how do I call dist() on one
column? But, I just found the answer in a translation from matlab to R -
you have to use drop=FALSE (and hopefully I am calling dist() on the right
thing)

euc.dist.axis1=dist(NMDS2[,1, drop=FALSE], method="euclidean")


Maybe this is obvious to other folks but just in case there is anyone like
me out there I figured I'd write back. Thanks for the info I have never
written to this list before because I always found what I needed online. I
appreciate your help and patience.


Cara



On Thu, Aug 28, 2014 at 10:19 PM, David L Carlson  wrote:

> Don't the functions metaMDSdist() and metaMDSredist() that are documented
> on the metaMDS manual page give you the distance matrix? If you want to
> compute the distances based on a single axis, you could use vegdist().
>
> David C
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Cara Fiore
> Sent: Thursday, August 28, 2014 7:02 PM
> To: r-help@r-project.org
> Subject: [R] distance matrix from metaMDS
>
> Dear R users,
>
> I would like to access the distance matrix generated by metaMDS as well as
> use the dist function to calculate the euclidean distance for each axis in
> the NMDS. I am having trouble finding a way to access these variables and
> any help is greatly appreciated.
>
> For the distance matrix I know I could just calculate the bray-curtis
> distance but it would be nice to know how to get it from the NMDS function.
> For the euclidean distance, the only thing I can find within metaMDS is
> the score function but there must be some way for me to call on/access the
> ordination distance for one axis right?
>
> The reason for this is I would like to do something like the stressplot
> function but for each axis.
>
> Thank you,
> Cara
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> 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
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] dont remenber my password

2014-08-29 Thread PIKAL Petr
That is bad, especially if it is password to your bank account. Maybe you shall 
write it down somewhere next time.

Petr

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Ernesto Villarino
> Sent: Friday, August 29, 2014 9:32 AM
> To: r-help@r-project.org
> Subject: [R] dont remenber my password
>
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
R-help@r-project.org mailing list
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] [R-pkgs] rsdmx - a package to read SDMX data and metadata

2014-08-29 Thread Emmanuel Blondel

Dear all,

The rsdmx package has been published in CRAN 
http://cran.r-project.org/web/packages/rsdmx/index.html.
rsdmx allows to read SDMX (Statistical Data and Metadata EXchange) data 
and metadata files, available in SDMX-ML format (XML).


For your information, its source code is managed at the following 
repository https://github.com/opensdmx/rsdmx


The current version is 0.3, and a change history is available at: 
https://github.com/opensdmx/rsdmx/wiki/Change-History. I also recommend 
to check out the rsdmx wiki page available at: 
https://github.com/opensdmx/rsdmx/wiki


I sincerely hope you will enjoy working with rsdmx. Feel free to contact 
me for questions or other feedback,


Emmanuel

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

__
R-help@r-project.org mailing list
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] dont remenber my password

2014-08-29 Thread David Winsemius
Your password is sent via email every month or so. 

-- 

David

On Aug 29, 2014, at 7:54 AM, PIKAL Petr wrote:

> That is bad, especially if it is password to your bank account. Maybe you 
> shall write it down somewhere next time.
> 
> Petr
> 
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
>> project.org] On Behalf Of Ernesto Villarino
>> Sent: Friday, August 29, 2014 9:32 AM
>> To: r-help@r-project.org
>> Subject: [R] dont remenber my password
>> 
>> 
>> 
snip

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list
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] nlsystemfit help

2014-08-29 Thread Francisco Goes
Hello,

 

For my master thesis I have fitted an individual tree diameter growth model
and a survival probability model separately using R, but I was told that
simultaneous estimation of these two models would minimize overall errors
and provide a variance-covariance matrix as a whole.

 

In that respect, can you please tell me if I can do it with nlssystemfit
using SUR (seemingly unrelated regression) method? If not, do you know how
can I do it in R?

 

My equations are:

 

- tree diameter growth model

 

d_richards_k<-d2~A*(1-exp(-(k0+k1*puro+k2*GL1/100+k3*1/G1+k4*Tmedmax/100+k5*
Perc_G_ec1))*(1-(d1/A)^(1-m)))^(1/(1-m))

nls_d_richards_k<-nlsLM(d_richards_k,start=list(A=100,k0=0.6,k1=0,k2=0,k3=0,
k4=0,k5=0,m=0.6),control=nls.lm.control(maxiter=500))

 

- survival probability model

 

mortal_final<-glm(sobrev~Verao+alto_fuste:puro+IC1arv+G1+Perc_G_ec1,family=b
inomial)

 

Thank you!

 

Best regards,

 

Francisco Goes


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] dont remenber my password

2014-08-29 Thread Prof Brian Ripley

On 29/08/2014 17:00, David Winsemius wrote:

Your password is sent via email every month or so.

And sending by email can be requested from 
https://stat.ethz.ch/mailman/listinfo/r-help, at least if you know the 
email address which you used to subscribe (otherwise look in the headers 
of messages sent from R-help).


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
R-help@r-project.org mailing list
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-tool - OS compatibility help

2014-08-29 Thread Mark Sharp
See
http://cran.r-project.org/
On Aug 28, 2014, at 11:41 PM, Ravi Kumar Rupakula wrote:

> Dear Support,
>
> Please let us know Windows 2008R2 OS compatibility for "R" tool is available 
> or not?
> If available, please let us know the details.
> --
> RaviKumar Rupakula | HP: +65-98537306 | Email: 
> r...@websynergies.biz | Web Synergies (S) Pte 
> Ltd
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> 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.


NOTICE:  This E-Mail (including attachments) is confidential and may be legally 
privileged.  It is covered by the Electronic Communications Privacy Act, 18 
U.S.C.2510-2521.  If you are not the intended recipient, you are hereby 
notified that any retention, dissemination, distribution or copying of this 
communication is strictly prohibited.  Please reply to the sender that you have 
received this message in error, then delete it.

__
R-help@r-project.org mailing list
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] environment question

2014-08-29 Thread Erin Hodgess
Hello!

Here is yet another question which I strongly suspect has a simple answer.

I build an RcmdrPlugin package and saved my workspace when I came out of R.

For some reason, it save the namespace of the plugin as an environment.

When I load the workspace back in, 2 environments appear,



and the regular global environment.

How do I remove the plugin environment from my workspace, please?

I've tried:
rm(namespace: RcmdrPlugin.gstats)
rm("namespace: RcmdrPlugin.gstats")
rm(RcmdrPlugin.gstats)
rm("RcmdrPlugin.gstats")

all to no avail.

Any help would be much appreciated.

sincerely,
Erin



-- 
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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-tool - OS compatibility help

2014-08-29 Thread Prof Brian Ripley

On 29/08/2014 18:28, Mark Sharp wrote:

See
http://cran.r-project.org/


Specifically, 
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Installation-and-Usage 
mentions Windows 2008.


The posting guide (see the footer of this message) asks you to look at 
the FAQs before posting.



On Aug 28, 2014, at 11:41 PM, Ravi Kumar Rupakula wrote:


Dear Support,

Please let us know Windows 2008R2 OS compatibility for "R" tool is available or 
not?
If available, please let us know the details.
--
RaviKumar Rupakula | HP: +65-98537306 | Email: 
r...@websynergies.biz | Web Synergies (S) Pte Ltd


   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.



NOTICE:  This E-Mail (including attachments) is confidential and may be legally 
privileged.  It is covered by the Electronic Communications Privacy Act, 18 
U.S.C.2510-2521.  If you are not the intended recipient, you are hereby 
notified that any retention, dissemination, distribution or copying of this 
communication is strictly prohibited.  Please reply to the sender that you have 
received this message in error, then delete it.

__
R-help@r-project.org mailing list
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.




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
R-help@r-project.org mailing list
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] Question regarding the discrepancy between count model parameter estimates between "pscl" and "MASS"

2014-08-29 Thread Nick Livingston
Thank you for your responses. 

Since my previous attempt to manually truncate my DV didn't work, I'm very 
interested in trying again using the zerotrun() function. However, I attempted 
to install "countreg" but received the following notification:

        Warning in install.packages :
              unable to access index for repository 
http://R-Forge.R-project.org/bin/macosx/contrib/3.0

              package ‘countreg’ is available as a source package but not as a 
binary
 
         Warning in install.packages :
              package ‘countreg’ is not available (for R version 3.0.3)

I received the same message when attempting to install it in version 3.1.0, and 
the latest version, 3.1.1. Am I missing something?

Thank you again. I appreciate your input.

-Nick

On Fri, 8/29/14, Achim Zeileis  wrote:

 Subject: Re: [R] Question regarding the discrepancy between count model 
parameter estimates between "pscl" and "MASS"
 To: "peter dalgaard" 
 Cc: "Nick Livingston" , r-help@r-project.org
 Date: Friday, August 29, 2014, 5:26 AM

 On Fri, 29 Aug 2014,
 peter dalgaard wrote:

 >
 I'm no expert on hurdle models, but it seems that you
 are unaware that 
 > the negative binomial
 and the truncated negative binomial are quite 
 > different things.

 Yes. You can replicate the truncated count part
 of the hurdle model with 
 the zerotrunc()
 function from the "countreg" package. The package
 is not 
 yet on CRAN but can be easily
 installed from R-Forge.

 > -pd
 >
 >
 > On 29 Aug 2014, at
 05:57 , Nick Livingston 
 wrote:
 >
 >> I have
 sought consultation online and in person, to no avail. I
 hope someone
 >> on here might have
 some insight. Any feedback would be most welcome.
 >>
 >> I am
 attempting to plot predicted values from a two-component
 hurdle model
 >> (logistic [suicide
 attempt yes/no] and negative binomial count [number of
 >> attempts thereafter]). To do so, I
 estimated each component separately using
 >> glm (MASS). While I am able to
 reproduce hurdle results for the logit
 >> portion in glm, estimates for the
 negative binomial count component are
 >> different.
 >>
 >> Call:
 >>
 hurdle(formula = Suicide. ~ Age + gender + Victimization *
 FamilySupport |
 >> Age + gender +
 Victimization * FamilySupport, dist = "negbin",
 link =
 >> "logit")
 >>
 >> Pearson
 residuals:
 >>     Min   
   1Q  Median      3Q     Max
 >> -0.9816 -0.5187 -0.4094  0.2974 
 5.8820
 >>
 >>
 Count model coefficients (truncated negbin with log
 link):
 >>                   
                          
    Estimate Std. Error z value
 >> Pr(>|z|)
 >>
 (Intercept)                          -0.29150 
   0.33127  -0.880   0.3789
 >> Age                       
               0.17068   
 0.07556   2.259   0.0239
 >> *
 >> gender   
                          
    0.28273   
 0.31614   0.894   0.3712
 >> Victimization               
          1.08405   
 0.18157   5.971 2.36e-09
 >>
 ***
 >> FamilySupport           
           0.33629   
 0.29302   1.148   0.2511
 >> Victimization:FamilySupport -0.96831 
   0.46841  -2.067   0.0387 *
 >> Log(theta)                 
           0.12245   
 0.54102   0.226   0.8209
 >> Zero hurdle model coefficients
 (binomial with logit link):
 >>     
                                        
     Estimate Std. Error z value
 >>
 Pr(>|z|)
 >> (Intercept)       
                
    -0.547051   0.215981  -2.533 
 0.01131
 >> *
 >>
 Age                                 
    -0.154493   0.063994  -2.414
 >> 0.01577 *
 >>
 gender                             
    -0.030942   0.284868  -0.109 
 0.91350
 >> Victimization         
                
 1.073956   0.338015   3.177 
 0.00149
 >> **
 >>
 FamilySupport                   
    -0.380360   0.247530  -1.537 
 0.12439
 >>
 Victimization\:FamilySupport 
 -0.813329   0.399905  -2.034  0.04197 *
 >> ---
 >> Signif.
 codes:  0 '***' 0.001 '**' 0.01 '*'
 0.05 '.' 0.1 ' ' 1
 >>
 >> Theta: count
 = 1.1303
 >> Number of iterations in
 BFGS optimization: 23
 >>
 Log-likelihood: -374.3 on 25 Df
 >>>
 summary(logistic)
 >>
 >>
 >>
 >>
 >> Call:
 >> glm(formula = SuicideBinary ~ Age +
 gender = Victimization * FamilySupport,
 >> family = "binomial")
 >>
 >> Deviance
 Residuals:
 >>     Min   
    1Q   Median       3Q 
     Max
 >> -1.9948  -0.8470 
 -0.6686   1.1160   2.0805
 >>
 >>
 Coefficients:
 >>             
                                    
 Estimate Std. Error z value
 >>
 Pr(>|z|)
 >> (Intercept)       
                   -0.547051   0.215981 
 -2.533  0.01131 *
 >> Age       
                            
 -0.154493   0.063994  -2.414  0.01577
 >> *
 >> gender   
                            
 -0.030942   0.284868  -0.109  0.91350
 >> Victimization               
      
    1.073956   0.338014   3.177 
 0.00149
 >> **
 >>
 FamilySupport                     
 -0.380360   0.247530  -1.537  0.12439
 >> Victimization:FamilySupport 
 -0.813329   0.399904  -2.034  0.04197 *
 >> ---
 >> Signif.
 codes:  0 ?**

[R] Conjoint Package

2014-08-29 Thread Vik Rubenfeld
I’m very glad to see the Conjoint Package for R. The documentation for it does 
not appear to specify methods for data acquisition. Are the cards to be 
individually scored by each respondent (most clients would rather see a 
choice-based methodology)?

SurveyGizmo, an excellent online survey host which I use, has in beta a 
Conjoint question type. However, it does not appear to calculate 
respondent-level utility values at this time. 

SurveyGizmo supports a conjoint question design in which each respondent is 
shown 3 cards at a time, and permitted to identify one of the three as Best, 
and one as Worst. (SG supports additional conjoint question designs as well).

Data acquired by SurveyGizmo conjoint looks like this for each respondent:

> Set #1
> Model Attribute   Model Value
> Price $300
> Size  7"
> Memory128 gb
> Score:50
> 
> Set #2
> Model Attribute   Model Value
> Price $100
> Size  4"
> Memory16 gb
> Score:0
> 
> Set #3
> Model Attribute   Model Value
> Price $200
> Size  6"
> Memory64 gb
> Score:100
> 
> Set #4
> Model Attribute   Model Value
> Price $100
> Size  5"
> Memory32 gb
> Score:100
> 
> Set #5
> Model Attribute   Model Value
> Price $200
> Size  5"
> Memory32 gb
> Score:0

Score 100 = Best 
Score 50 = Not selected
Score 0 = Worst

Is it possible to use the R-Project Conjoint Package with a data file like 
this, to calculate respondent-level utility values? In other words, are the 
scores (100, 50, 0) input that the Conjoint Package can use?

Thanks very much in advance to all for any info!

Best,


-Vik
__
R-help@r-project.org mailing list
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] Question regarding the discrepancy between count model parameter estimates between "pscl" and "MASS"

2014-08-29 Thread David Winsemius

On Aug 29, 2014, at 9:46 AM, Nick Livingston wrote:

> Thank you for your responses. 
> 
> Since my previous attempt to manually truncate my DV didn't work, I'm very 
> interested in trying again using the zerotrun() function. However, I 
> attempted to install "countreg" but received the following notification:
> 
> Warning in install.packages :
>   unable to access index for repository 
> http://R-Forge.R-project.org/bin/macosx/contrib/3.0
> 
>   package ‘countreg’ is available as a source package but not as 
> a binary
> 
>  Warning in install.packages :
>   package ‘countreg’ is not available (for R version 3.0.3)
> 
> I received the same message when attempting to install it in version 3.1.0, 
> and the latest version, 3.1.1. Am I missing something?

Apparently understanding that R-forge is not CRAN.  If the package has any 
compiled code, then you need to have the proper tools installed. See the 
R-Mac-FAQ if those are needed. I generally download the source file and install 
from disk. 

install.packages("~/countreg_0.1-1.tar.gz", repo=NULL, type="source")

(That reported success on a SL Mac R 3.1.0 machine. And there did not appear to 
be any compiled code so the Mac "tool chain" was not needed. The other way to 
check for that possibility is to look at the DESCRIPTION file.)

-- 
David.

> 
> Thank you again. I appreciate your input.
> 
> -Nick
> 
> On Fri, 8/29/14, Achim Zeileis  wrote:
> 
> Subject: Re: [R] Question regarding the discrepancy between count model 
> parameter estimates between "pscl" and "MASS"
> To: "peter dalgaard" 
> Cc: "Nick Livingston" , r-help@r-project.org
> Date: Friday, August 29, 2014, 5:26 AM
> 
> On Fri, 29 Aug 2014,
> peter dalgaard wrote:
> 
>> 
> I'm no expert on hurdle models, but it seems that you
> are unaware that 
>> the negative binomial
> and the truncated negative binomial are quite 
>> different things.
> 
> Yes. You can replicate the truncated count part
> of the hurdle model with 
> the zerotrunc()
> function from the "countreg" package. The package
> is not 
> yet on CRAN but can be easily
> installed from R-Forge.
> 
>> -pd
>> 
>> 
>> On 29 Aug 2014, at
> 05:57 , Nick Livingston 
> wrote:
>> 
>>> I have
> sought consultation online and in person, to no avail. I
> hope someone
>>> on here might have
> some insight. Any feedback would be most welcome.
>>> 
>>> I am
> attempting to plot predicted values from a two-component
> hurdle model
>>> (logistic [suicide
> attempt yes/no] and negative binomial count [number of
>>> attempts thereafter]). To do so, I
> estimated each component separately using
>>> glm (MASS). While I am able to
> reproduce hurdle results for the logit
>>> portion in glm, estimates for the
> negative binomial count component are
>>> different.
>>> 
>>> Call:
>>> 
> hurdle(formula = Suicide. ~ Age + gender + Victimization *
> FamilySupport |
>>> Age + gender +
> Victimization * FamilySupport, dist = "negbin",
> link =
>>> "logit")
>>> 
>>> Pearson
> residuals:
>>>  Min   
>   1Q  Median  3Q Max
>>> -0.9816 -0.5187 -0.4094  0.2974 
> 5.8820
>>> 
>>> 
> Count model coefficients (truncated negbin with log
> link):
>>>
>  
>Estimate Std. Error z value
>>> Pr(>|z|)
>>> 
> (Intercept)  -0.29150 
>   0.33127  -0.880   0.3789
>>> Age   
>   0.17068   
> 0.07556   2.259   0.0239
>>> *
>>> gender   
>  
>0.28273   
> 0.31614   0.894   0.3712
>>> Victimization   
>  1.08405   
> 0.18157   5.971 2.36e-09
>>> 
> ***
>>> FamilySupport   
>   0.33629   
> 0.29302   1.148   0.2511
>>> Victimization:FamilySupport -0.96831 
>   0.46841  -2.067   0.0387 *
>>> Log(theta) 
>   0.12245   
> 0.54102   0.226   0.8209
>>> Zero hurdle model coefficients
> (binomial with logit link):
>>>  
>
> Estimate Std. Error z value
>>> 
> Pr(>|z|)
>>> (Intercept)   
>
>-0.547051   0.215981  -2.533 
> 0.01131
>>> *
>>> 
> Age 
>-0.154493   0.063994  -2.414
>>> 0.01577 *
>>> 
> gender 
>-0.030942   0.284868  -0.109 
> 0.91350
>>> Victimization 
>
> 1.073956   0.338015   3.177 
> 0.00149
>>> **
>>> 
> FamilySupport   
>-0.380360   0.247530  -1.537 
> 0.12439
>>> 
> Victimization\:FamilySupport 
> -0.813329   0.399905  -2.034  0.04197 *
>>> ---
>>> Signif.
> codes:  0 '***' 0.001 '**' 0.01 '*'
> 0.05 '.' 0.1 ' ' 1
>>> 
>>> Theta: count
> = 1.1303
>>> Number of iterations in
> BFGS optimization: 23
>>> 
> Log-likelihood: -374.3 on 25 Df
 
> summary(logistic)
>>> 
>>> 
>>> 
>>> 
>>> Call:
>>> glm(formula = SuicideBinary ~ Age +
> gender = Victimization * FamilySupport,
>>> family = "binomial")
>>> 

Re: [R] Question regarding the discrepancy between count model parameter estimates between "pscl" and "MASS"

2014-08-29 Thread Prof Brian Ripley

On 29/08/2014 17:46, Nick Livingston wrote:

Thank you for your responses.

Since my previous attempt to manually truncate my DV didn't work, I'm very interested in 
trying again using the zerotrun() function. However, I attempted to install 
"countreg" but received the following notification:

 Warning in install.packages :
   unable to access index for repository 
http://R-Forge.R-project.org/bin/macosx/contrib/3.0

   package ‘countreg’ is available as a source package but not as a 
binary

  Warning in install.packages :
   package ‘countreg’ is not available (for R version 3.0.3)

I received the same message when attempting to install it in version 3.1.0, and 
the latest version, 3.1.1. Am I missing something?


As the package does not contain compiled code, you can simply install 
from the sources.  (I just did so in the GUI: just untick 'binary'.)



Thank you again. I appreciate your input.

-Nick

On Fri, 8/29/14, Achim Zeileis  wrote:

  Subject: Re: [R] Question regarding the discrepancy between count model parameter estimates 
between "pscl" and "MASS"
  To: "peter dalgaard" 
  Cc: "Nick Livingston" , r-help@r-project.org
  Date: Friday, August 29, 2014, 5:26 AM

  On Fri, 29 Aug 2014,
  peter dalgaard wrote:

  >
  I'm no expert on hurdle models, but it seems that you
  are unaware that
  > the negative binomial
  and the truncated negative binomial are quite
  > different things.

  Yes. You can replicate the truncated count part
  of the hurdle model with
  the zerotrunc()
  function from the "countreg" package. The package
  is not
  yet on CRAN but can be easily
  installed from R-Forge.

  > -pd
  >
  >
  > On 29 Aug 2014, at
  05:57 , Nick Livingston 
  wrote:
  >
  >> I have
  sought consultation online and in person, to no avail. I
  hope someone
  >> on here might have
  some insight. Any feedback would be most welcome.
  >>
  >> I am
  attempting to plot predicted values from a two-component
  hurdle model
  >> (logistic [suicide
  attempt yes/no] and negative binomial count [number of
  >> attempts thereafter]). To do so, I
  estimated each component separately using
  >> glm (MASS). While I am able to
  reproduce hurdle results for the logit
  >> portion in glm, estimates for the
  negative binomial count component are
  >> different.
  >>
  >> Call:
  >>
  hurdle(formula = Suicide. ~ Age + gender + Victimization *
  FamilySupport |
  >> Age + gender +
  Victimization * FamilySupport, dist = "negbin",
  link =
  >> "logit")
  >>
  >> Pearson
  residuals:
  >> Min
1Q  Median  3Q Max
  >> -0.9816 -0.5187 -0.4094  0.2974
  5.8820
  >>
  >>
  Count model coefficients (truncated negbin with log
  link):
  >>

 Estimate Std. Error z value
  >> Pr(>|z|)
  >>
  (Intercept)  -0.29150
0.33127  -0.880   0.3789
  >> Age
0.17068
  0.07556   2.259   0.0239
  >> *
  >> gender

 0.28273
  0.31614   0.894   0.3712
  >> Victimization
   1.08405
  0.18157   5.971 2.36e-09
  >>
  ***
  >> FamilySupport
0.33629
  0.29302   1.148   0.2511
  >> Victimization:FamilySupport -0.96831
0.46841  -2.067   0.0387 *
  >> Log(theta)
0.12245
  0.54102   0.226   0.8209
  >> Zero hurdle model coefficients
  (binomial with logit link):
  >>

  Estimate Std. Error z value
  >>
  Pr(>|z|)
  >> (Intercept)

 -0.547051   0.215981  -2.533
  0.01131
  >> *
  >>
  Age
 -0.154493   0.063994  -2.414
  >> 0.01577 *
  >>
  gender
 -0.030942   0.284868  -0.109
  0.91350
  >> Victimization

  1.073956   0.338015   3.177
  0.00149
  >> **
  >>
  FamilySupport
 -0.380360   0.247530  -1.537
  0.12439
  >>
  Victimization\:FamilySupport
  -0.813329   0.399905  -2.034  0.04197 *
  >> ---
  >> Signif.
  codes:  0 '***' 0.001 '**' 0.01 '*'
  0.05 '.' 0.1 ' ' 1
  >>
  >> Theta: count
  = 1.1303
  >> Number of iterations in
  BFGS optimization: 23
  >>
  Log-likelihood: -374.3 on 25 Df
  >>>
  summary(logistic)
  >>
  >>
  >>
  >>
  >> Call:
  >> glm(formula = SuicideBinary ~ Age +
  gender = Victimization * FamilySupport,
  >> family = "binomial")
  >>
  >> Deviance
  Residuals:
  >> Min
 1Q   Median   3Q
  Max
  >> -1.9948  -0.8470
  -0.6686   1.1160   2.0805
  >>
  >>
  Coefficients:
  >>

  Estimate Std. Error z value
  >>
  Pr(>|z|)
  >> (Intercept)
-0.547051   0.215981
  -2.533  0.01131 *
  >> Age

  -0.154493   0.063994  -2.414  0.01577
  >> *
  >> gender

  -0.030942   0.284868  -0.109  0.91350
  >> Victimization

 1.073956   0.338014   3.177
  0.00149
  >> **
  >>
  FamilySupport
  -0.380360   0.247530  -1.537  0.12439
  >> Victimization:FamilySupport
  -0.813329   0.399904  -2.034  0.04197 *
  >> ---
  >> Signif.
  codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
  >>
  >> (Dispersion
  parameter for binomial family taken to be 1)
  >>
  >>
 Null deviance: 452.54 

Re: [R] Best cross-platform OSS GUI CSV management application?

2014-08-29 Thread Grant Rettke
On Wed, Aug 27, 2014 at 7:10 PM, Jeff Newmiller
 wrote:
> Please stop posting on this plain text list using HTML. You are not a 
> freshman any more.

My sincere apologies, will do, accidentally left Gmail configured as such.

> Is anyone really considering the use of a word processor (equivalent to MS 
> Word) for managing this tabular
> data?

Excel.

> A better solution is to create a SQL database

Gotcha.

__
R-help@r-project.org mailing list
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] Not display message when using system()

2014-08-29 Thread Marc Girondot

Dear list members,

My question concerns the use of system() in R version 3.1.1 patched and 
MacosX 10.9.4.
I want capture the result of a system command without displaying error 
message. I give exemple.


In terminal, if I do this command:
find $HOME -type f -name 'PuertoSanJose.csv'

I get the correct answer but also a message about Permission denied for 
one directory:

/Users/marc/Dropbox/DropBoxPerso/Data_Ale/Original/PuertoSanJose.csv
find: /Users/marc/Library/Saved Application 
State/com.adobe.flashplayer.installmanager.savedState/data.data: 
Permission denied


I want get the output of this command in R; then I do:
> pathfile <- system("find $HOME -type f -name 'PuertoSanJose.csv'", 
intern=TRUE, ignore.stderr = TRUE)

Message d'avis :
l'exécution de la commande 'find $HOME -type f -name 'PuertoSanJose.csv' 
2>/dev/null' renvoie un statut 1


In pathfile, I have the correct answer but I have also a message that I 
don't want.


My question is then: How to prevent display this message?

I try the following:
> pathfile <- capture.output(system("find $HOME -type f -name 
'PuertoSanJose.csv'", intern=TRUE, ignore.stderr = TRUE))

Message d'avis :
l'exécution de la commande 'find $HOME -type f -name 'PuertoSanJose.csv' 
2>/dev/null' renvoie un statut 1


The same

I try also:
> pathfile <- suppressMessages(system("find $HOME -type f -name 
'PuertoSanJose.csv'", intern=TRUE, ignore.stderr = TRUE))

Message d'avis :
l'exécution de la commande 'find $HOME -type f -name 'PuertoSanJose.csv' 
2>/dev/null' renvoie un statut 1


The same

The only solution to not see this message is:
> pathfile <- system("find $HOME -type f -name 'PuertoSanJose.csv'", 
intern=FALSE, ignore.stderr = TRUE)

/Users/marc/Dropbox/DropBoxPerso/Data_Ale/Original/PuertoSanJose.csv
> pathfile
[1] 1

But pathfile does not capture the output.

And the use of capture.output() does not help:
> pathfile <- capture.output(system("find $HOME -type f -name 
'PuertoSanJose.csv'", intern=FALSE, ignore.stderr = TRUE))

/Users/marc/Dropbox/DropBoxPerso/Data_Ale/Original/PuertoSanJose.csv
> pathfile
character(0)


I really don't know how to not see this message...
If someone knows, I will appreciate !

Marc

__
R-help@r-project.org mailing list
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] Not display message when using system()

2014-08-29 Thread Henrik Bengtsson
As a start try to use system2() instead and look at its argument for how to
capture stdout and/or stderr. It's a neater function.

It may be that those messages cannot be captured easily, but hopefully they
are.

My $0.02

Henrik
On Aug 29, 2014 12:21 PM, "Marc Girondot"  wrote:

> Dear list members,
>
> My question concerns the use of system() in R version 3.1.1 patched and
> MacosX 10.9.4.
> I want capture the result of a system command without displaying error
> message. I give exemple.
>
> In terminal, if I do this command:
> find $HOME -type f -name 'PuertoSanJose.csv'
>
> I get the correct answer but also a message about Permission denied for
> one directory:
> /Users/marc/Dropbox/DropBoxPerso/Data_Ale/Original/PuertoSanJose.csv
> find: /Users/marc/Library/Saved Application State/com.adobe.flashplayer.
> installmanager.savedState/data.data: Permission denied
>
> I want get the output of this command in R; then I do:
> > pathfile <- system("find $HOME -type f -name 'PuertoSanJose.csv'",
> intern=TRUE, ignore.stderr = TRUE)
> Message d'avis :
> l'exécution de la commande 'find $HOME -type f -name 'PuertoSanJose.csv'
> 2>/dev/null' renvoie un statut 1
>
> In pathfile, I have the correct answer but I have also a message that I
> don't want.
>
> My question is then: How to prevent display this message?
>
> I try the following:
> > pathfile <- capture.output(system("find $HOME -type f -name
> 'PuertoSanJose.csv'", intern=TRUE, ignore.stderr = TRUE))
> Message d'avis :
> l'exécution de la commande 'find $HOME -type f -name 'PuertoSanJose.csv'
> 2>/dev/null' renvoie un statut 1
>
> The same
>
> I try also:
> > pathfile <- suppressMessages(system("find $HOME -type f -name
> 'PuertoSanJose.csv'", intern=TRUE, ignore.stderr = TRUE))
> Message d'avis :
> l'exécution de la commande 'find $HOME -type f -name 'PuertoSanJose.csv'
> 2>/dev/null' renvoie un statut 1
>
> The same
>
> The only solution to not see this message is:
> > pathfile <- system("find $HOME -type f -name 'PuertoSanJose.csv'",
> intern=FALSE, ignore.stderr = TRUE)
> /Users/marc/Dropbox/DropBoxPerso/Data_Ale/Original/PuertoSanJose.csv
> > pathfile
> [1] 1
>
> But pathfile does not capture the output.
>
> And the use of capture.output() does not help:
> > pathfile <- capture.output(system("find $HOME -type f -name
> 'PuertoSanJose.csv'", intern=FALSE, ignore.stderr = TRUE))
> /Users/marc/Dropbox/DropBoxPerso/Data_Ale/Original/PuertoSanJose.csv
> > pathfile
> character(0)
>
>
> I really don't know how to not see this message...
> If someone knows, I will appreciate !
>
> Marc
>
> __
> R-help@r-project.org mailing list
> 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
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] posterior probabilities from lda.predict

2014-08-29 Thread Fraser D. Neiman
Dear All,

I have used the lda() function in the MASS library to estimate a set of 
discriminant functions to assign samples from a training set to one of six 
groups.  The cross validation generates nearly perfect predictions for samples 
in the training set.  Hooray!

Now I want to use lda.predict() to estimate both discriminant function scores 
and probabilities of group membership for a second set of samples whose group 
membership is unknown.  For each unknown sample, lda.predict() produces a six 
probabilities. These probabilities sum to one. So lda.predict() seems to assume 
that the unknown samples do, in fact, belong to one of the six groups.  

The problem is that it is nearly certain that some of the unknown samples in 
the second set do not belong to any of the six groups. For those samples, 
probabilities of group membership should be close to zero for all six groups.  
In fact, identifying which samples are unlikely to belong to any of the six 
groups is a major goal of the analysis. 

So the question is, what is lda.predict() doing behind the scenes to force the 
group membership probabilities to sum to one? How do I get it to not do this 
and produce probabilities that accurately reflect the large Mahalanobis 
distances of some of the unknown sample from any group centroid?\

I have searched the R-list archive on this and have found several folks asking 
similar questions, but no helpful answers.

Thanks very much!

Fraser
__
R-help@r-project.org mailing list
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] Bus stop sequence matching problem

2014-08-29 Thread Adam Lawrence
I am hoping someone can help me with a bus stop sequencing problem in R,
where I need to match counts of people getting on and off a bus to the
correct stop in the bus route stop sequence. I have tried looking
online/forums for sequence matching but seems to refer to numeric sequences
or DNA matching and over my head. I am after a simple example if anyone can
please help.

I have two data series as per below (from database), that I want to
combine. In this example “stop_sequence” includes the equence (seq) of bus
stops and “stop_onoff” is a count of people getting on and off at certain
stops (there is no entry if noone gets on or off).

stop_sequence <- data.frame(seq=c(10,20,30,40,50,60),
ref=c('A','B','C','D','B','A'))
##   seq ref
## 1  10   A
## 2  20   B
## 3  30   C
## 4  40   D
## 5  50   B
## 6  60   A
stop_onoff <-
data.frame(ref=c('A','D','B','A'),on=c(5,0,10,0),off=c(0,2,2,6))
##   ref on off
## 1   A  5   0
## 2   D  0   2
## 3   B 10   2
## 4   A  0   6

I need to match the stop_onoff numbers in the right sto sequence, with the
correctly matched output as follows (load is a cumulative count of on and
off)

desired_output <- data.frame(seq=c(10,20,30,40,50,60),
ref=c('A','B','C','D','B','A'),
on=c(5,'-','-',0,10,0),off=c(0,'-','-',2,2,6), load=c(5,0,0,3,11,5))
##   seq ref on off load
## 1  10   A  5   05
## 2  20   B  -   -0
## 3  30   C  -   -0
## 4  40   D  0   23
## 5  50   B 10   2   11
## 6  60   A  0   65

In this example the stop “B” is matched to the second stop “B” in the stop
sequence and not the first because the onoff data is after stop “D”.

Any guidance much appreciated.

Regards
Adam

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Unexpected behavior when giving a value to a new variable basedon the value of another variable

2014-08-29 Thread David McPearson
On Fri, 29 Aug 2014 06:33:01 -0700 Jeff Newmiller 
wrote

> One clue is the help file for "$"...
> 
> ?" $"
> 
> In particular there see the discussion of character indices and the "exact"
> argument. 
>

<...snip...>
> 
> On August 29, 2014 1:53:47 AM PDT, Angel Rodriguez
>  wrote: >
> >Dear subscribers,
> >
> >I've found that if there is a variable in the dataframe with a name
<...sip...>
> >> N <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58), V2 =
> >c(NA, 1, 1, 1, 1,1,1,1,NA)), 
> >+ .Names = c("age","samplem"), row.names = c(NA,
> >-9L), class = "data.frame")
> >> N$sample[N$age >= 65] <- 1 
> >> N
> >  age samplem sample
> >1  67  NA  1
> >2  62   1  1
> >3  74   1  1
> >4  61   1  1
> >5  60   1  1
> >6  55   1  1
> >7  60   1  1
> >8  59   1  1
> >9  58  NA NA
<...snip...>

Having seen all the responses about partial matching I almost understand. I've
also replicated the behaviour on R 2.11.1 so it's been around awhile. This
tells me it ain't a bug - so if any of the cognoscenti have the time and
inclination can someone give me a brief (and hopefully simple) explanation of
what is going on under the hood?

It looks (to me) like N$sample[N$age >= 65] <- 1 copies N$samplem to N$sample
and then does the assignment. If partial matching is the problem (which it
clearly is) my expectation is that  the  output should look like

   age samplem
1   67   1
2   62   1
3   74   1
4   61   1
5   60   1
6   55   1
7   60   1
8   59   1
9   58  NA
That is - no new column.
(and I just hate it when the world doesn't live up to my expectations!)

Bewildered and confused,
DMcP


South Africas premier free email service - www.webmail.co.za 

Cotlands - Shaping tomorrows Heroes http://www.cotlands.org.za/

__
R-help@r-project.org mailing list
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.