[R] odd listing in R object

2010-07-29 Thread Lawrence Hanser
Dear R Colleagues,

When I run ls() on an R object given to me by a colleague, one of the
objects is shown literally as:

females[\dp\]

I can neither look into it nor can I get rid of it (rm(major[\dp\]).

Ideas or solutions?

Thanks,

Larry

[[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] repeated measures specification in lmer

2009-03-23 Thread Lawrence Hanser
Dear Colleagues,
I have what Roger Kirk (Experimental Design: Procedures for the Behavioral
Sciences, 1968) refers to as a randomized block factorial design.  The anova
table would look like this:

  df
A 3
Subj/A  103 (error term for A)
B   23
A*B69
B*Subj/A 2369 (error term for B and A*B)

Subjects are nested within A and give a response for each B.  If y is the
dependent variable, is this the correct lmer specification for the above,
where ID is the variable name for Subj:

lmer(y ~ A + B + A*B + (A|ID))

Am I barking up the right tree?  I can also fit:

aov(y ~ A + B + A*B  + ID)
then I have to do some hand calculations to use ID as the error term for A.
 The residual (really B*ID) is the correct error term for B and A*B.

Thanks,

Larry

[[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] specifying repeated measures model in lmer

2009-03-23 Thread Lawrence Hanser
Dear Colleagues,
I have what Roger Kirk (Experimental Design: Procedures for the Behavioral
Sciences, 1968) refers to as a randomized block factorial design.  The anova
table would look like this:

  df
A 3
Subj/A  103 (error term for A)
B   23
A*B69
B*Subj/A 2369 (error term for B and A*B)

Subjects are nested within A and give a response for each B.  If y is the
dependent variable, is this the correct lmer specification for the above,
where ID is the variable name for Subj:

lmer(y ~ A + B + A*B + (A|ID))

Am I barking up the right tree?  I can also fit:

aov(y ~ A + B + A*B  + ID)
then I have to do some hand calculations to use ID as the error term for A.
 The residual (really B*ID) is the correct error term for B and A*B.

Thanks,

Larry

[[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] tcltk, tcltk2, Rcmdr, Mac OS X

2009-02-11 Thread Lawrence Hanser
John was spot on.  Turns out that when I don't load the workspace Rcmdr
starts up just fine.  It hadn't occurred to me that a workspace could be
corrupt...

On Tue, Feb 10, 2009 at 5:12 PM, John Fox j...@mcmaster.ca wrote:

 Dear Larry,

 That's odd: The only lmer of which I'm aware is a function in the lme4
 package, and it creates objects of class mer, I believe. What this has to
 do with the Rcmdr package is beyond me, since the Rcmdr doesn't depend upon
 lme4, but, on the other hand, shouldn't conflict with it. I don't think
 that
 you've mentioned it, but I assume that you're using the current version
 (1.4-7) of the Rcmdr package.

 Is it possible that you have a saved and damaged workspace that's being
 loaded at the start of your R session? If so, remove the saved workspace
 (I'm afraid that I don't know where that lives on a Mac, but I suppose that
 getwd() would show you).

 John


  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On
  Behalf Of Lawrence Hanser
  Sent: February-10-09 7:43 PM
  To: r-help@r-project.org
  Subject: Re: [R] tcltk, tcltk2, Rcmdr, Mac OS X
 
  Thanks.
  I seem to have gotten a bit further, but still not completely successful.
 
  BTW, I should have said that I am running R 2.8.1 GUI 1.27 Tiger build
  32-bit (5301).
 
  X11 starts fine from the icon.
  library(tcltk) loads fine.
 
  Now I get this when I load Rcmdr:
 
  --
   library(Rcmdr)
  Loading required package: car
  Error in getClass(class(x)) : lmer is not a defined class
  Error : .onAttach failed in 'attachNamespace'
  Error: package/namespace load failed for 'Rcmdr'
  --
 
  Any help would be appreciated.
 
  Larry
 
 
 
  On Tue, Feb 10, 2009 at 3:08 PM, John Fox j...@mcmaster.ca wrote:
 
   Dear Larry,
  
   The tcltk package is part of the standard R distribution; it doesn't
 live
   on
   CRAN, and should already be installed. Have you tried loading tcltk
   directly
   -- library(tcltk)?
  
   It's possible that you don't have X11 Tcl/Tk installed on your Mac.
 Take
 a
   look at the Rcmdr installation notes for Macs, at
   http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html,
 if
   you
   haven't already done so.
  
   I hope this helps,
John
  
   --
   John Fox, Professor
   Department of Sociology
   McMaster University
   Hamilton, Ontario, Canada
   web: socserv.mcmaster.ca/jfox
  
  
-Original Message-
From: r-help-boun...@r-project.org
 [mailto:r-help-boun...@r-project.org]
   On
Behalf Of Lawrence Hanser
Sent: February-10-09 5:01 PM
To: r-help@r-project.org
Subject: [R] tcltk, tcltk2, Rcmdr, Mac OS X
   
Dear Colleagues,
When I try to install Rcmdr the following happens:
   
--
 library(Rcmdr)
Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk),
   class
   =
tclObj) :
  [tcl] invalid command name font.
   
Error : .onAttach failed in 'attachNamespace'
Error: package/namespace load failed for 'Rcmdr'
--
   
I wondered if this is because there is no tcltk package installed.
 So
   I
tried:
   
--
 install.packages(tcltk)
Warning in install.packages(tcltk) :
  argument 'lib' is missing: using '/Users/hanser/Library/R/library'
Warning message:
package 'tcltk' is not available
--
   
Is there in fact a tcltk package?  Has it been replaced by tcltk2?
   
Help appreciated.
   
Regards,
   
Larry
   
  [[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.




[[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] tcltk, tcltk2, Rcmdr, Mac OS X

2009-02-11 Thread Lawrence Hanser
Monte,
I vaguely remember having exactly the same error message at some point in my
journey.  Why don't you try simply loading tcltk first to see if you can
then load Rcmdr:

library(tcltk)



On Wed, Feb 11, 2009 at 3:03 PM, Peter Dalgaard p.dalga...@biostat.ku.dkwrote:

 Monte Milanuk wrote:

 Larry,

 Since it looks like you've got your problem about whipped, hope you don't
 mind if I piggy back on here...

 Same sort of problem... installed Rcmdr via the Package Installer.
  Followed the directions for running X11/Tk ala the site mentioned
 earlier and this is what I get when I try to run Rcmdr:

   library(Rcmdr)
 Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class
 = tclObj) :
  [tcl] invalid command name font.

 Error : .onAttach failed in 'attachNamespace'
 Error: package/namespace load failed for 'Rcmdr'

 Any help would be greatly appreciated.


 Hum. Sounds like you're getting through to Tcl but not Tk. Are you able to
 run the wish shell (usually comes with Tcl/Tk, although I'm not sure about
 Mac).

-pd

 --
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907


 __
 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] tcltk, tcltk2, Rcmdr, Mac OS X

2009-02-10 Thread Lawrence Hanser
Dear Colleagues,
When I try to install Rcmdr the following happens:

--
 library(Rcmdr)
Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class =
tclObj) :
  [tcl] invalid command name font.

Error : .onAttach failed in 'attachNamespace'
Error: package/namespace load failed for 'Rcmdr'
--

I wondered if this is because there is no tcltk package installed.  So I
tried:

--
 install.packages(tcltk)
Warning in install.packages(tcltk) :
  argument 'lib' is missing: using '/Users/hanser/Library/R/library'
Warning message:
package 'tcltk' is not available
--

Is there in fact a tcltk package?  Has it been replaced by tcltk2?

Help appreciated.

Regards,

Larry

[[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] tcltk, tcltk2, Rcmdr, Mac OS X

2009-02-10 Thread Lawrence Hanser
Thanks.
I seem to have gotten a bit further, but still not completely successful.

BTW, I should have said that I am running R 2.8.1 GUI 1.27 Tiger build
32-bit (5301).

X11 starts fine from the icon.
library(tcltk) loads fine.

Now I get this when I load Rcmdr:

--
 library(Rcmdr)
Loading required package: car
Error in getClass(class(x)) : lmer is not a defined class
Error : .onAttach failed in 'attachNamespace'
Error: package/namespace load failed for 'Rcmdr'
--

Any help would be appreciated.

Larry



On Tue, Feb 10, 2009 at 3:08 PM, John Fox j...@mcmaster.ca wrote:

 Dear Larry,

 The tcltk package is part of the standard R distribution; it doesn't live
 on
 CRAN, and should already be installed. Have you tried loading tcltk
 directly
 -- library(tcltk)?

 It's possible that you don't have X11 Tcl/Tk installed on your Mac. Take a
 look at the Rcmdr installation notes for Macs, at
 http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html, if
 you
 haven't already done so.

 I hope this helps,
  John

 --
 John Fox, Professor
 Department of Sociology
 McMaster University
 Hamilton, Ontario, Canada
 web: socserv.mcmaster.ca/jfox


  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On
  Behalf Of Lawrence Hanser
  Sent: February-10-09 5:01 PM
  To: r-help@r-project.org
  Subject: [R] tcltk, tcltk2, Rcmdr, Mac OS X
 
  Dear Colleagues,
  When I try to install Rcmdr the following happens:
 
  --
   library(Rcmdr)
  Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk),
 class
 =
  tclObj) :
[tcl] invalid command name font.
 
  Error : .onAttach failed in 'attachNamespace'
  Error: package/namespace load failed for 'Rcmdr'
  --
 
  I wondered if this is because there is no tcltk package installed.  So
 I
  tried:
 
  --
   install.packages(tcltk)
  Warning in install.packages(tcltk) :
argument 'lib' is missing: using '/Users/hanser/Library/R/library'
  Warning message:
  package 'tcltk' is not available
  --
 
  Is there in fact a tcltk package?  Has it been replaced by tcltk2?
 
  Help appreciated.
 
  Regards,
 
  Larry
 
[[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.


[R] Tukey on interaction means after lmer

2008-12-23 Thread Lawrence Hanser
Dear Colleagues,
I fit this model:

mod1 - lmer(x~category*comp+(1|id),data=impchiefsrm)

where category has 4 levels and comp has 8 levels.

These work:

glht(mod1, linfct=mcp(category=Tukey)
glht(mod1, linfct=mcp(comp=Tukey)

What I'd like is (conceptually):

glht(mod1, linfct=mcp(category:comp=Tukey)

but it gives a syntax error.

Any help is appreciated.

Thanks,

Larry

[[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] post hoc comparisons on interaction means following lme

2008-12-22 Thread Lawrence Hanser
Dear Colleagues,
I have scoured the help files and been unable to find an answer to my
question.  Please forgive me if I have missed something obvious.

I have run the following two models, where category has 3 levels and
comp has 8 levels:

mod1 - lmer(x~category+comp+(1|id),data=impchiefsrm)
mod2 - lmer(x~category+comp+category*comp+(1|id),data=impchiefsrm)

followed by:

anova(mod1,mod2)

The anova shows that the interaction term specified in the second model is
significant when added to the main effects model.

Now I'd like to run post hoc comparisons using glht to discern where the
interaction means differ.  For example, for post hoc comparisons on the
means of the main effect of category I can run:

summary(glht(mod2,linfct=mcp(category=Tukey)))

But this only gives me the mean comparisons for the category main effect
means.  Essentially I'd like to run the following:

summary(glht(mod2,linfct=mcp(category*comp=Tukey)))

to get the mean comparisons for the interaction means.  Perhaps needless to
say, this command does not work.

Can someone tell me how to run multiple comparisons among the interaction's
means?

I suspect that specifying the correct contrasts would do it, but I can't
figure out how to setup the contrasts...

Thanks,

Larry

[[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] lme4 question

2008-10-22 Thread Lawrence Hanser
Dear R Colleagues,

I run the following two models:

mod1 - lmer(y ~ category + subcomp + (1 | id))
mod2 - lmer(y ~ category + subcomp + category*subcomp + (1 | id)

where:
category has 4 possible values
subcomp has 24 possible values
id has approx 120 values (id is nested within category, and in unequal
numbers--i.e., unbalanced)

Then to look for differences in the models I run:

anova(mod1, mod2)

I receive this warning message after the last command:

In data != data[[1]] :
  longer object length is not a multiple of shorter object length


I think I know why this is happening (i.e., the two models are of
different length).  Is my surmise correct?  If I am correct I don't
think I should worry.  Should I?

Thanks.

__
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] lme4 question

2008-10-22 Thread Lawrence Hanser
Re Doug's comment:

I apologize for being incomplete--I do know better.

I did explicitly include a data statement in the models, but didn't
write the model statements properly in my post.  Here are the actual
model statements:


mod1 - lmer(y ~ category + subcomp + (1 | id), data=prepchiefs08rm)
mod2 - lmer(y ~ category + subcomp + category*subcomp + (1 | id),
data=prepchiefs08rm)

Thanks.

On Wed, Oct 22, 2008 at 2:41 PM, Douglas Bates [EMAIL PROTECTED] wrote:
 On Wed, Oct 22, 2008 at 4:18 PM, Lawrence Hanser [EMAIL PROTECTED] wrote:
 Dear R Colleagues,

 I run the following two models:

 mod1 - lmer(y ~ category + subcomp + (1 | id))
 mod2 - lmer(y ~ category + subcomp + category*subcomp + (1 | id)

 where:
 category has 4 possible values
 subcomp has 24 possible values
 id has approx 120 values (id is nested within category, and in unequal
 numbers--i.e., unbalanced)

 Then to look for differences in the models I run:

 anova(mod1, mod2)

 I receive this warning message after the last command:

 In data != data[[1]] :
  longer object length is not a multiple of shorter object length

 That piece of code is comparing the values of the data arguments in
 the call slot of the fitted models.  These are what are known as
 matched calls (produced by the function match.call).  The second model
 you show seems incomplete.  Did you miss a closing parenthesis or did
 you have an explicit data argument?

 I always use an explicit data argument and I probably implicitly
 thought that others would do that when I wrote the piece of code in
 question.  I suppose I could remove that check or replace it with a
 better one.  The purpose of the code is to determine if it is
 reasonable to compare the model fits by checking if the models were
 fit to the same data.


 I think I know why this is happening (i.e., the two models are of
 different length).  Is my surmise correct?  If I am correct I don't
 think I should worry.  Should I?

 Thanks.

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


__
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] lmer for two models followed by anova to compare the two models

2008-10-16 Thread Lawrence Hanser
Dear Colleagues,

I run this model:

mod1 - lmer(x~category+subcomp+category*subcomp+(1|id),data=impchiefsrm)

obtain this summary result:

Linear mixed-effects model fit by REML
Formula: x ~ category + subcomp + category * subcomp + (1 | id)
  Data: impchiefsrm
 AIC  BIC logLik MLdeviance REMLdeviance
4102 4670  -1954   3665 3908
Random effects:
Groups   NameVariance Std.Dev.
id   (Intercept) 0.11562  0.34003
Residual 0.22765  0.47713
number of obs: 2568, groups: id, 107


run this model (only difference is I've removed the interaction term):

mod2 - lmer(x~category+subcomp+(1|id),data=impchiefsrm)

obtain this summary result:

Linear mixed-effects model fit by REML
Formula: x ~ category + subcomp + (1 | id)
   Data: impchiefsrm
  AIC  BIC logLik MLdeviance REMLdeviance
 3987 4151  -1966   3823 3931
Random effects:
 Groups   NameVariance Std.Dev.
 id   (Intercept) 0.11528  0.33953
 Residual 0.23584  0.48564
number of obs: 2568, groups: id, 107

Note that the loglik from the first model is -1954 and from the second
model loglik is -1966.

Next, to test the difference between the two models I run:

anova(mod1, mod2) and obtain this result:

Data: impchiefsrm
Models:
mod2: x ~ category + subcomp + (1 | id)
mod1: x ~ category + subcomp + category * subcomp + (1 | id)
 Df AIC BIC  logLik  Chisq Chi Df Pr(Chisq)
mod2 28  3879.1  4042.9 -1911.5
mod1 97  3859.3  4426.9 -1832.7 157.72 69   6.71e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Note that in this result the logLiks are reported as -1832.7 and
-1911.5 respectively for models 1 and 2.

Now my question:

Why are the logLiks from the anova command that compares the two
models different from what was reported in the separate model results?

Thanks,

Larry

__
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] Plot means with error bars - A novice needs help

2008-10-09 Thread Lawrence Hanser
Dear Colleagues,

I think the allure of bargraph.CI is that it makes it easy to plot
standard errors--though you still have to fiddle with the options to
get the size of confidence interval you want. And there is the
(strong) dislike of dynamite plots by some (the ink to info argument).

Box and whisker plots have such a tradition of meaning in the boxes
and whiskers that to add standard errors requires some additional work
and explanation, and even then standard error markings are easily lost
among the usual box and whisker plot markings.

I have looked only briefly at tplot(), but don't recall seeing an easy
way to add standard errors. Have I missed it?  Would it be an easy
add?  A bad idea?

Regards,

Larry

On 10/8/08, hadley wickham [EMAIL PROTECTED] wrote:
 On Tue, Oct 7, 2008 at 11:31 PM, Michael Just [EMAIL PROTECTED] wrote:
 Hello,
 I'd appreciate a suggestion on how to construct plots (barplots?) that use
 means on the Y axis instead of density/count. I'd also like to use groups
 and plot error or confidence interval bars on these graphs. I know this is
 a
 read the manual situation. I'd appreciate help with what to read, or your
 benevolence with some sample code.

 Here's an alternative suggestion - don't use bars, use dots.  Bar
 plots with standard errors are sometime called dynamite plots
 (probably because they should be blown up).  See
 http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/DynamitePlots and
 http://emdbolker.wikidot.com/blog:dynamite for some reasons not to use
 them and possible alternatives.

 I hope that package authors who provide methods to make these plots
 easy will reconsider.

 Hadley

 --
 http://had.co.nz/

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


-- 
Sent from my mobile device

__
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] creating table of averages

2008-09-09 Thread Lawrence Hanser
Dear Colleagues,

I have a dataframe with variables:

  [1] ID category   a11a12
a13a21
  [7] a22a23a31a32
b11b12
 [13] b13b21b31b32
b33b41
 [19] b42c11c12c21
c22c23
 [25] c31c32c33d11
d12d13
 [31] d14d21d22d23
d24d25
 [37] d31d32d33e11
e12e13
 [43] e21e22e23e31
e32e33
 [49] f11f12f13f14
f21f22
 [55] f23f24g11g12
g13g14
 [61] g21g22g23g24
g31g32
 [67] g33g41g42g43
h11h12
 [73] h13h21h22h23
C1.Employ  SC11.Ops
 [79] SC12.Unit  SC13.Nonadvers C2.Enterprise  SC21.Structure
SC22.Gov   SC23.Culture
 [85] SC24.Stratcomm C3.Manage  SC31.Resource  SC32.Change
SC33.Continue  C4.Stratthink
 [91] SC41.VisionSC42.Decision  SC43.Adapt C5.Lead
SC51.Develop   SC52.Care
 [97] SC53.Diversity C6.Foster  SC61.Teams SC62.Negotiate
C7.Embody  SC71.Ethical
[103] SC72.Follower  SC73.Warrior   SC74.Develop   C8.Comm
C81.Speak  C82.Listen
[109] OverallImp

The variable category has four values: Regular, CCM, CFM, and Other

I'd like to create a table like this to feed into barplot2:

row.name  C1.Employ C2.Enterprise  C3.Manage  C4.Stratthink  C5.Lead
C6.Foster  C7.Embody  C8.Comm
Regular 3.68  4.27 3.22
etc..
CCM 4.32  4.56  etc.
CFM  etc.
Other etc.

So far, I have been able to get this far:

 
mean(subset(impchiefs08,category==Regular,select=c(C1.Employ,C2.Enterprise,C3.Manage,C4.Stratthink,C5.Lead,C6.Foster,C7.Embody,C8.Comm
)))
C1.Employ C2.Enterprise C3.Manage C4.Stratthink   C5.Lead
C6.Foster C7.Embody   C8.Comm
 3.60  3.85  4.48  4.346667  4.608889
4.44  4.60  4.49


But I am stumped as to how to get what I want.

Thanks in advance.

Larry

[[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] creating table of averages

2008-09-09 Thread Lawrence Hanser
Perfect!

Thanks.


On Tue, Sep 9, 2008 at 11:27 AM, Duncan Murdoch [EMAIL PROTECTED]wrote:

 On 9/9/2008 2:12 PM, Adam D. I. Kramer wrote:

 Maybe something like this:

 by(df[,c(77,81,86,90,94,98,101,106)],df$category,apply,2,mean)

 ...which would then need to be reformatted into a data frame (there is
 probably an easy way to do this which I don't know).


 sparseby() in the reshape package is more flexible than by(). If the
 function returns a vector with a consistent length, you'll get a dataframe
 with columns corresponding to its entries.

 Duncan Murdoch



 aggregate seems like a more reasonable choice, but the function for
 aggregate must return scalars, not rows...tapply doesn't take data.frame
 inputs. Maybe someone else has a suggestion?

 --Adam

 On Tue, 9 Sep 2008, Lawrence Hanser wrote:

  Dear Colleagues,

 I have a dataframe with variables:

  [1] ID category   a11a12
 a13a21
  [7] a22a23a31a32
 b11b12
 [13] b13b21b31b32
 b33b41
 [19] b42c11c12c21
 c22c23
 [25] c31c32c33d11
 d12d13
 [31] d14d21d22d23
 d24d25
 [37] d31d32d33e11
 e12e13
 [43] e21e22e23e31
 e32e33
 [49] f11f12f13f14
 f21f22
 [55] f23f24g11g12
 g13g14
 [61] g21g22g23g24
 g31g32
 [67] g33g41g42g43
 h11h12
 [73] h13h21h22h23
 C1.Employ  SC11.Ops
 [79] SC12.Unit  SC13.Nonadvers C2.Enterprise  SC21.Structure
 SC22.Gov   SC23.Culture
 [85] SC24.Stratcomm C3.Manage  SC31.Resource  SC32.Change
 SC33.Continue  C4.Stratthink
 [91] SC41.VisionSC42.Decision  SC43.Adapt C5.Lead
 SC51.Develop   SC52.Care
 [97] SC53.Diversity C6.Foster  SC61.Teams SC62.Negotiate
 C7.Embody  SC71.Ethical
 [103] SC72.Follower  SC73.Warrior   SC74.Develop   C8.Comm
 C81.Speak  C82.Listen
 [109] OverallImp

 The variable category has four values: Regular, CCM, CFM, and Other

 I'd like to create a table like this to feed into barplot2:

 row.name  C1.Employ C2.Enterprise  C3.Manage  C4.Stratthink  C5.Lead
 C6.Foster  C7.Embody  C8.Comm
 Regular 3.68  4.27 3.22
 etc..
 CCM 4.32  4.56  etc.
 CFM  etc.
 Other etc.

 So far, I have been able to get this far:

 

 mean(subset(impchiefs08,category==Regular,select=c(C1.Employ,C2.Enterprise,C3.Manage,C4.Stratthink,C5.Lead,C6.Foster,C7.Embody,C8.Comm
 )))
   C1.Employ C2.Enterprise C3.Manage C4.Stratthink   C5.Lead
 C6.Foster C7.Embody   C8.Comm
3.60  3.85  4.48  4.346667  4.608889
 4.44  4.60  4.49



 But I am stumped as to how to get what I want.

 Thanks in advance.

 Larry

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


 __
 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] histogram tick labels

2008-06-09 Thread Lawrence Hanser
Dear Friends,

I am doing a rather simple histogram on a vector of data, MR.  I set
breaks for the intervals:

hist(MR,breaks=c(0, 2.9, 5.9, 8.9, 11.9,14.9, 17.9, 20.9))

My question is, how do I change the labels on the tick marks?  I have
looked at ?hist and can't find a clue...

Thanks in advance.

Larry

__
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] Documentation General Comments

2008-04-24 Thread Lawrence Hanser
Dear Colleagues,

It seems to me that the issue is not whether the information we seek
is in the documentation.  I, for one, am amazed at the quality of the
documentation of R and of contributed materials.  For me the issue is
one of finding the information in an efficient way out of the
mountains of information in the official and unofficial documentation
of R.  Part of this is on the head of the seeker of information to
generate keywords that will lead a search engine to find what we are
looking for.  But part of it is on the heads of contributors to insure
that relevant keywords are associated with relevant content in a way
that the search engine will find it and rank order it in a sensible
way.

Take RSiteSearch(), for example.  Are we as a user and contributor
group familiar with the scoring scheme that Namazu uses to score and
order the information it finds?  I refer you to:
http://www.namazu.org/doc/tips.html for this information.  For
example, if Namazu finds a keyword in a meta name =keywords
content=... tag the score is bumped by 32 points.  Finding a
keyword in a title tag is worth 16 points, etc.  Also on the
referenced url page we are essentially told not to use more than two
words in the search.  It seems to me that knowing these things alone
will help authors increase the quality of searches and seekers to more
easily find what they are looking for.

My thanks to all the contributors who have made R a terrific system.

Regards,

Larry


On Thu, Apr 24, 2008 at 8:55 PM, Kingsford Jones
[EMAIL PROTECTED] wrote:
 I just read through this thread and I didn't see the R Language
  Definition mentioned.  As with An Introduction to R it can be accessed
  -- at least in my Windows GUI -- via the menu bar: Help - Manuals (in
  PDF).  If An Introduction to R is too basic, then the Language
  Definition should be a good place to look for more details on R
  objects (Ch 2).  However An Introduction to R does include
  authoritative introductions to the data types mentioned by the
  original poster: factors (Ch4), arrays and matrices (Ch 5), and lists
  and data frames (Ch 6).

  That said, I agree that learning efficiency could be improved by
  augmenting the manuals with tables similar to the table 2.1 that was
  referenced earlier in the thread (aside: are functions, or even lists,
  really Data Objects?). Of course, as pointed out by Duncan, we are
  collaborators not consumers, so if I think there should be more tables
  in the documents then the onus is on me to try to get my ideas
  incorporated (see
  http://wiki.r-project.org/rwiki/doku.php?id=misc:rpatch ).

  Kingsford Jones

  On Thu, Apr 24, 2008 at 9:37 AM, Duncan Murdoch [EMAIL PROTECTED] wrote:
   On 4/24/2008 12:08 PM, Martin Maechler wrote:
 Hmm,

 KeBe == Beck, Kenneth (STP) [EMAIL PROTECTED]
 on Thu, 24 Apr 2008 10:12:19 -0500 writes:

 KeBe OK I've spent a lot of time with the core
 KeBe documentation, and I never found anything as simple as
 KeBe their table 2.1, which elucidated the difference
 KeBe between a vector, matrix and array first, then the
 KeBe higher level structures, frame and list.  Maybe I'm
 KeBe not a good searcher, but believe me for every initial
 KeBe posting I submit to this group, I have spent hours
 KeBe trying to find the answer elsewhere. And, as you
 KeBe state, maybe I am now deluded by that presentation,
 KeBe maybe it is not this simple!

 Well, I get the impression that you've never read the manual
   Introduction to R
   (or some good book such as Peter Dalgaard's)
 but have directly jumped into reading  help() pages  ???
  
That's not correct.  Kenneth started the thread (on Monday) saying:
  
  
The basic tutorial Introduction to R is so basic, it
hardly helps at all, then digging through documentation is really an
exercise in frustration.
  
Duncan Murdoch
  
  
  

 Maybe a good idea would be to improve the Introduction to R
 rather than thinking of misusing the help() collection
 {which is the reference manual, not the user manual !!}
 by making it easy to understand (and consequently less precise) ??

 Patches (well reflected ..) to the Introduction are quite
 welcome, indeed.
 The (development) source is always available
 at https://svn.r-project.org/R/trunk/doc/manual/R-intro.texi

 (and yes, the source does look a bit less user-friendly,
  than its PDF output, e.g.
  http://cran.r-project.org/doc/manuals/R-intro.pdf
  or its  daily updated  HTML output at
  http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-intro.html
 )

 Regards,
 Martin

 KeBe Look at the help for data.frame. VERY terse
 KeBe explanation, with not a good comparison to the other
 KeBe data types. Then, look at the titles list. Where is a
 KeBe topic for data 

[R] interactive rotating graphics

2008-04-01 Thread Lawrence Hanser
Dear Colleagues,

Seems I had in the past run across the capability to create a
three-dimensional scatterplot where I could use the mouse to grab
the plot and rotate the axes with the mouse.  I have used RSiteSearch
and found a few things (e.g., TeachingDemos, iplot) but cannot find
the package/function that does the above.  There was also the
capability to use the mouse to select and identify a single point.

Any help pointing me in the right direction is appreciated.

Larry

__
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] SAS data

2008-03-14 Thread Lawrence Hanser
Looks to me like you are trying to read sas.exe as your data rather
than MyData.sa7bdat

Larry

On Fri, Mar 14, 2008 at 8:21 AM, Samuel Okoye [EMAIL PROTECTED] wrote:
 Hello,

   I am trying to read the SAS file MyData.sa7bdat in R! This file is saved 
 under D:\data! I therefore wrote

path -D:/SasData
sashome - C/Progra, Files/SAS Institute/9_1/SAS
sascmd - file.path(sashome, sas.exe)
MyData - read.ssd(path, MyData, sascmd=sascmd)

   The results what I get:

   SAS failed.  SAS program at C:\DOCUME~1\Temp\RtmpcTlKtb\file4eb43288.sas
  The log file will be file4eb43288.log in the current directory
  NULL
  Warning message:
  SAS return code was 2 in: read.ssd(path, MyData, sascmd = sascmd)

   Thank you in advance!
   Sam


  -

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