[R] barplot, for loop?

2007-03-10 Thread Lauri Nikkinen
Hi R-users,



I have a dataset like this:



kuvaaja

kuva

yhteispisteet

Hannu

isokala

8

Hannu

kaapin alta löytynyt

2

Hannu

kaapin alta löytynyt 2

8

Hannu

limamikko

1

Hannu

maukasta marmeladia

8

Hannu

skrinnareita

4

Hate

madekoukkujen suojelupyhimys

3

Hate

matka aikaan joka ei enää palaa

3

Hate

munat puoliks padassa

6

Hate

pyynikki

2

Hate

vailla armeerausta

2

Lassi

ajatelkaa, jos Häntä ei olisikaan

2

Lassi

elämän viiva

7

Lassi

pedot

1

Lassi

portsan kundi

3

Lauri

hipö

3

Lauri

jääpuut

5

Lauri

kökar

3

Lauri

lumipuu

9

Petteri

harmaaleppä

5

Petteri

viileä harakka

2

Teemu

harppi

2

Teemu

Homo sapiens angelus

3

Teemu

kainostelua

1

Teemu

pinnalla

5

Teemu

portinvartija

6

Teemu

puikot

1

Teemu

verkkovaja

3



I have done this:



pisteet.hannu - subset(pisteet.sum, kuvaaja == Hannu, select=c(kuva,
yhteispisteet))

(pisteet.hannu - pisteet.hannu[rev(order(pisteet.hannu$yhteispisteet)),])

pisteet.lauri - subset(pisteet.sum, kuvaaja == Lauri, select=c(kuva,
yhteispisteet))

(pisteet.lauri - pisteet.lauri[rev(order(pisteet.lauri$yhteispisteet)),])

pisteet.lassi - subset(pisteet.sum, kuvaaja == Lassi, select=c(kuva,
yhteispisteet))

(pisteet.lassi - pisteet.lassi[rev(order(pisteet.lassi$yhteispisteet)),])

pisteet.teemu - subset(pisteet.sum, kuvaaja == Teemu, select=c(kuva,
yhteispisteet))

(pisteet.teemu - pisteet.teemu[rev(order(pisteet.teemu$yhteispisteet)),])

pisteet.petteri - subset(pisteet.sum, kuvaaja == Petteri, select=c(kuva,
yhteispisteet))

(pisteet.petteri - pisteet.petteri[rev(order(pisteet.petteri$yhteispisteet
)),])

pisteet.hate - subset(pisteet.sum, kuvaaja == Hate, select=c(kuva,
yhteispisteet))

(pisteet.hate - pisteet.hate[rev(order(pisteet.hate$yhteispisteet)),])



opar - par(mfrow=c(2,3), mar=c(11,3,3,3))



barplot(as.vector(pisteet.hannu$yhteispisteet),

names.arg=as.vector(pisteet.hannu$kuva),

las=3,

cex.names=0.8,

main=Hannu,

ylim=c(0,10)

)

barplot(as.vector(pisteet.lauri$yhteispisteet),

names.arg=as.vector(pisteet.lauri$kuva),

las=3,

cex.names=0.8,

main=Lauri,

ylim=c(0,10)

)

barplot(as.vector(pisteet.lassi$yhteispisteet),

names.arg=as.vector(pisteet.lassi$kuva),

las=3,

cex.names=0.8,

main=Lassi,

ylim=c(0,10)

)

barplot(as.vector(pisteet.teemu$yhteispisteet),

names.arg=as.vector(pisteet.teemu$kuva),

las=3,

cex.names=0.8,

main=Teemu,

ylim=c(0,10)

)

barplot(as.vector(pisteet.petteri$yhteispisteet),

names.arg=as.vector(pisteet.petteri$kuva),

las=3,

cex.names=0.8,

main=Petteri,

ylim=c(0,10)

)

barplot(as.vector(pisteet.hate$yhteispisteet),

names.arg=as.vector(pisteet.hate$kuva),

las=3,

cex.names=0.8,

main=Hate,

ylim=c(0,10)

)

par(opar)


Queston is: how do I do this more effectively e.g. using for loop (without
subsetting, straight from the original data)? Thanks in advance!

-Lauri

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] barplot, for loop?

2007-03-10 Thread Lauri Nikkinen
I put the data again because it looks like it went all mixed up. Data is
named pisteet.sum. First row is the header row.

kuvaaja kuva yhteispisteet
Hannu isokala 8
Hannu kaapin alta löytynyt 2
Hannu kaapin alta löytynyt2 8
Hannu limamikko 1
Hannu maukasta marmeladia 8
Hannu skrinnareita 4
Hate madekoukkujen suojelupyhimys 3
Hate matka aikaan joka ei enää palaa 3
Hate munat puoliks padassa 6
Hate pyynikki 2
Hate vailla armeerausta 2
Lassi ajatelkaa, jos Häntä ei olisikaan 2
Lassi elämän viiva 7
Lassi pedot 1
Lassi portsan kundi 3
Lauri hipö 3
Lauri jääpuut 5
Lauri kökar 3
Lauri lumipuu 9
Petteri harmaaleppä 5
Petteri viileä harakka 2
Teemu harppi 2
Teemu Homo sapiens angelus 3
Teemu kainostelua 1
Teemu pinnalla 5
Teemu portinvartija 6
Teemu puikot 1
Teemu verkkovaja 3



10.3.2007 Lauri Nikkinen [EMAIL PROTECTED] kirjoitti:

 Hi R-users,




-Lauri

 I have a dataset like this:



 kuvaaja

 kuva

 yhteispisteet

 Hannu

 isokala

 8

 Hannu

 kaapin alta löytynyt

 2

 Hannu

 kaapin alta löytynyt 2

 8

 Hannu

 limamikko

 1

 Hannu

 maukasta marmeladia

 8

 Hannu

 skrinnareita

 4

 Hate

 madekoukkujen suojelupyhimys

 3

 Hate

 matka aikaan joka ei enää palaa

 3

 Hate

 munat puoliks padassa

 6

 Hate

 pyynikki

 2

 Hate

 vailla armeerausta

 2

 Lassi

 ajatelkaa, jos Häntä ei olisikaan

 2

 Lassi

 elämän viiva

 7

 Lassi

 pedot

 1

 Lassi

 portsan kundi

 3

 Lauri

 hipö

 3

 Lauri

 jääpuut

 5

 Lauri

 kökar

 3

 Lauri

 lumipuu

 9

 Petteri

 harmaaleppä

 5

 Petteri

 viileä harakka

 2

 Teemu

 harppi

 2

 Teemu

 Homo sapiens angelus

 3

 Teemu

 kainostelua

 1

 Teemu

 pinnalla

 5

 Teemu

 portinvartija

 6

 Teemu

 puikot

 1

 Teemu

 verkkovaja

 3



 I have done this:



 pisteet.hannu - subset(pisteet.sum, kuvaaja == Hannu, select=c(kuva,
 yhteispisteet))

 (pisteet.hannu - pisteet.hannu[rev(order(pisteet.hannu$yhteispisteet)),])

 pisteet.lauri - subset(pisteet.sum, kuvaaja == Lauri, select=c(kuva,
 yhteispisteet))

 (pisteet.lauri - pisteet.lauri[rev(order(pisteet.lauri$yhteispisteet)),])

 pisteet.lassi - subset(pisteet.sum, kuvaaja == Lassi, select=c(kuva,
 yhteispisteet))

 (pisteet.lassi - pisteet.lassi[rev(order(pisteet.lassi$yhteispisteet)),])

 pisteet.teemu - subset(pisteet.sum, kuvaaja == Teemu, select=c(kuva,
 yhteispisteet))

 (pisteet.teemu - pisteet.teemu[rev(order(pisteet.teemu$yhteispisteet)),])

 pisteet.petteri - subset(pisteet.sum, kuvaaja == Petteri,
 select=c(kuva, yhteispisteet))

 (pisteet.petteri - pisteet.petteri[rev(order(
 pisteet.petteri$yhteispisteet)),])

 pisteet.hate - subset(pisteet.sum, kuvaaja == Hate, select=c(kuva,
 yhteispisteet))

 (pisteet.hate - pisteet.hate[rev(order(pisteet.hate$yhteispisteet)),])



 opar - par(mfrow=c(2,3), mar=c(11,3,3,3))



 barplot(as.vector(pisteet.hannu$yhteispisteet),

 names.arg=as.vector(pisteet.hannu$kuva),

 las=3,

 cex.names=0.8,

 main=Hannu,

 ylim=c(0,10)

 )

 barplot(as.vector(pisteet.lauri$yhteispisteet),

 names.arg=as.vector(pisteet.lauri$kuva),

 las=3,

 cex.names=0.8,

 main=Lauri,

 ylim=c(0,10)

 )

 barplot(as.vector(pisteet.lassi$yhteispisteet),

 names.arg=as.vector(pisteet.lassi$kuva),

 las=3,

 cex.names=0.8,

 main=Lassi,

 ylim=c(0,10)

 )

 barplot(as.vector(pisteet.teemu$yhteispisteet),

 names.arg=as.vector(pisteet.teemu$kuva),

 las=3,

 cex.names=0.8,

 main=Teemu,

 ylim=c(0,10)

 )

 barplot(as.vector(pisteet.petteri$yhteispisteet),

 names.arg=as.vector(pisteet.petteri$kuva),

 las=3,

 cex.names=0.8,

 main=Petteri,

 ylim=c(0,10)

 )

 barplot(as.vector(pisteet.hate$yhteispisteet),

 names.arg=as.vector(pisteet.hate$kuva),

 las=3,

 cex.names=0.8,

 main=Hate,

 ylim=c(0,10)

 )

 par(opar)


 Queston is: how do I do this more effectively e.g. using for loop (without
 subsetting, straight from the original data)? Thanks in advance!

 -Lauri


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] Problem with ci.lmer() in package:gmodels

2007-03-10 Thread Gregory Warnes

Hello Michael,

I checked the source code, and the lower and upper confidence interval 
endpoints were simply reversed.  The calculations themselves are correct.

I have uploaded a new version of the gmodels package to the CRAN repository, 
and it should show up in a couple of days.  In the mean time, you can either 
simply reverse them manually, or modify the source file est.lmer to swap the 
two endpoints.   

The new package also fixes the two places where my email address wasn't 
properly updated.

-Greg


From: Michael Kubovy kubovy_at_virginia.edu
Date: Fri 09 Mar 2007 - 10:08:28 GMT


Dear Friends,

Please note that in the following CI lower  CI higher:

 require(lmer)
 require(gmodels)
 fm2 - lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject),
sleepstudy)
 ci(fm2)

  Estimate  CI lower   CI upper Std. Error p-value
(Intercept) 251.66693 266.06895 238.630280   7.056447   0
Days 10.52773  13.63372   7.389946   1.646900   0



_


Professor Michael Kubovy
University of Virginia
Department of Psychology

USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766


WWW: http://www.people.virginia.edu/~mk9y/
R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Using large datasets: can I overload the subscript operator?

2007-03-10 Thread Gabor Grothendieck
On 3/9/07, Maciej Radziejewski [EMAIL PROTECTED] wrote:
 Hello,

 I do some computations on datasets that come from climate models. These data
 are huge arrays, significantly larger than typically available RAM, so they
 have to be accessed row-by-row, or rather slice-by slice, depending on the
 task. I would like to make an R package to easily access such datasets
 within R. The C++ backend is ready and being used under Windows/.Net/Visual
 Basic, but I have yet to learn the specifics of R programming to make a good
 R interface.

 I think it should be possible to make a package (call it slice) that could
 be used like this:

 library (slice)
 dataset - load.virtualarray (dataset_definition.xml)
 ordinaryvector - dataset [ , 2, 3] # Load a portion of the data from disk
 and extract it

 In the above dataset is an object that holds a definition of a
 3-dimensional large dataset, and ordinaryvector is an ordinary R vector.
 The subscripting operator fetches necessary data from disk and extracts a
 required slice, taking care of caching and other technical details. So, my
 questions are:

 Has anyone ever made a similar extension, with virtual (lazy) arrays?

Not quite the same but you might look at the g.data delayed data package
in case its good enough for your needs.  Note the dot.  gdata without a dot
is a different package.


 Can the suscript operator be overloaded like that in R? (I know it can be in
 S, at least for vectors.)

Yes.  You make your objects a class, myclass, and then define
[.myclass - function...
 for myclass in the S3 class system and similarly in S4.  S3 is easier
to develop for and has higher performance so you probably want that
rather than S4.

A few examples packages are XML (see [.XMLNode), fame and zoo for
S3 and 'its' for S4.

Be sure to check out
?.subset
See think post for context:
http://tolstoy.newcastle.edu.au/R/devel/05/05/0853.html


 And a tough one: is it possible to make an expression like [1] (without
 quoutes) meaningful in R? At the moment it results in a syntax error. I
 would like to make it return an object of a special class that gets
 interpreted when subscripting my virtual array as drop this dimension,
 like this:

 dataset [, 2, 3, drop = F]  # Return a 3-dimensional array
 dataset [, [2], 3, drop = F]  # Return a 2-dimensional array
 dataset [, [2], [3], drop = F]  # Return a 1-dimensional array, like dataset
 [, 2, 3]

No but one idea is to define the single letter . (i.e. a dot) to be of a special
class, dot say and define [.dot to produce objects of a special
class (maybe also
dot).   Then you could write dataset[, .[2], .[3], drop = FALSE] if
you define [.myclass to look for such objects.

Another possibility is to use formula notation:

dataset[, ~2, ~3, drop = FALSE]

and have [.myclass handle formula arguments specially of perhaps forget
about that notation and just extend drop:

dataset[drop = 2:3]

BTW, its better to use FALSE rather than F since F can be a variable name.

__
R-help@stat.math.ethz.ch 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] dendrogram - got it , just need to label :)

2007-03-10 Thread bunny , lautloscrew.com
thx very much!
that helps to give those nodes somewhat dynamic names, so a legend to  
explain those numbers would be a solution, i´ll think about.
Anyway, is it possible to name the nodes by hand, for example call  
node1 myname1, node2 something else and so on ?


best

-m.


P.S.: Are there further packages you use for the dendrograms that you  
could recommend ?




Am 10.03.2007 um 04:33 schrieb Steven McKinney:

 local({
   edgeLab - function(n) {
   if(!is.leaf(n)) {
 a - attributes(n)
 i - i+1
 attr(n, edgetext) -
 format(i)
   }
   n
   }
   i - 0
  })
 dL - dendrapply(as.dendrogram(hclust(dist(iris[, 1:4]), method =  
 single)), edgeLab)
 plot(dL)


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] long character string problem

2007-03-10 Thread toby909
Hi All

I am having 2 very long character strings (550chars) and I want to put them as 
expressions together with c(). The problem is that I also get these 
double-quotes, as seen below in 'fct'. How can I remove these double-quotes? I 
tried as.name() but it did not work (because of size?). These are creating 
trouble with subsequent programs, which I tested with strings that for some 
reason do not have these double quotes (see very bottom).

Thanks Toby




  cum1
[1] 
A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)
  cum2
[1] 
A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)
  fct = c(as.expression(cum1), as.expression(cum2))
  fct
expression(A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110),
 

 
A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210))
 








  fct = c(expression(2*x1^3-7*x2^2-9), expression(x1^2-x2^3+1))
  fct
expression(2 * x1^3 - 7 * x2^2 - 9, x1^2 - x2^3 + 1)

__
R-help@stat.math.ethz.ch 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] piecing together statements (macro?)

2007-03-10 Thread toby909
Hi All

I am pretty new to R but saw stata and sas's macro facilities and am looking 
for 
how such things work in R.

I am trying to piece together a series of statements:


n = 5   #want to have it dynamic with respect to n
for (j in 1:n) {
eval(paste(x, j, =x[, j, ], sep=))
}

I want the created statements 'x1=x[1]' immediately executed and tried to do 
that with eval() but that did not work.

Any hints greatly appreciates.

Thanks Toby

__
R-help@stat.math.ethz.ch 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] Mac vs. PC

2007-03-10 Thread Richard Morey
My adviser has a Mac notebook that he bought 6 months ago, and I have a 
PC notebook I bought a month ago. Here are the respective specs, as far 
as I know them:

His:
Mac OSX
1 GB DDR2 RAM
Intel Core Duo, 2 GHz (2MB cache per core)
Unknown HD

Mine
Windows Vista Home Premium 32bit
2 GB DDR2 RAM
Intel Core 2 Duo, 2 GHz (4MB cache)
5400 RPM Hard Drive


We are both running R. As a test to see whose laptop was faster, we 
decided to invert large random matrices. In R language, it looks like this:

N=2000
A=rnorm(N^2)
A=matrix(A,ncol=N)
solve(A)

This creates a matrix of 4,000,000 random normal deviates and inverts 
it. His computer takes about 7 seconds, while mine takes about 14. Why 
the difference? I have several working hypotheses, and it would be 
interesting to see what you guys think.

1. R on Mac was compiled with optimizations for the CPU, with R for 
Windows was not. I could test this by compiling R with the Intel 
compiler, or GCC with optimizations, and seeing if I get a significant 
speed boost.

2. His R is 64 bit, while mine is for 32 bit windows. (I'm not sure how 
much of a diference that makes, or whether OSX is 64 bit.)

3. Data is getting swapped to the hard drive, and my hard drive is 
slower than his. I chose a slower hard drive to get bigger capacity for 
the price.

This is not intended to be an OMG MACOS = TEH R0X0R thread. I'm just 
trying to explain the discrepency.

Thanks!

__
R-help@stat.math.ethz.ch 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] useR! 2007 --- Call for papers and posters

2007-03-10 Thread Dianne Cook
R Users and Developers,

The first North American useR! will be held at Iowa State University,  
Ames, Iowa, August 8–10, 2007. Information about the meeting can be  
found at http://www.user2007.org/.

We are now ready to accept paper and poster submissions.

Papers are encouraged in all areas, but particular emphasis is given  
to work describing newly created or improved R packages. Papers will  
be refereed and a best paper/presentation award is likely. Your full  
paper needs to be submitted by April 23, 5:00PM CST, to be considered  
for the meeting.

There will also be the opportunity to present your work as a poster  
instead of a paper. Poster submissions will be in the form of an  
abstract and needs to be submitted by June 30.

Submit full papers, and poster abstracts, to [EMAIL PROTECTED]

useR! Program Committee
[EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
R-help@stat.math.ethz.ch 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] piecing together statements (macro?)

2007-03-10 Thread Gabor Grothendieck
Read the FAQ 7.21:

http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f

Note that it points out that you don't really want to do this anyways.

On 3/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi All

 I am pretty new to R but saw stata and sas's macro facilities and am looking 
 for
 how such things work in R.

 I am trying to piece together a series of statements:


 n = 5   #want to have it dynamic with respect to n
 for (j in 1:n) {
 eval(paste(x, j, =x[, j, ], sep=))
 }

 I want the created statements 'x1=x[1]' immediately executed and tried to do
 that with eval() but that did not work.

 Any hints greatly appreciates.

 Thanks Toby

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Mac vs. PC

2007-03-10 Thread Gabor Grothendieck
Such a calculation would be dominated by the time spent inside a call
to an offf-the-shelf C matrix inversion library used by R and is not really
any test of R itself.

On 3/9/07, Richard Morey [EMAIL PROTECTED] wrote:
 My adviser has a Mac notebook that he bought 6 months ago, and I have a
 PC notebook I bought a month ago. Here are the respective specs, as far
 as I know them:

 His:
 Mac OSX
 1 GB DDR2 RAM
 Intel Core Duo, 2 GHz (2MB cache per core)
 Unknown HD

 Mine
 Windows Vista Home Premium 32bit
 2 GB DDR2 RAM
 Intel Core 2 Duo, 2 GHz (4MB cache)
 5400 RPM Hard Drive


 We are both running R. As a test to see whose laptop was faster, we
 decided to invert large random matrices. In R language, it looks like this:

 N=2000
 A=rnorm(N^2)
 A=matrix(A,ncol=N)
 solve(A)

 This creates a matrix of 4,000,000 random normal deviates and inverts
 it. His computer takes about 7 seconds, while mine takes about 14. Why
 the difference? I have several working hypotheses, and it would be
 interesting to see what you guys think.

 1. R on Mac was compiled with optimizations for the CPU, with R for
 Windows was not. I could test this by compiling R with the Intel
 compiler, or GCC with optimizations, and seeing if I get a significant
 speed boost.

 2. His R is 64 bit, while mine is for 32 bit windows. (I'm not sure how
 much of a diference that makes, or whether OSX is 64 bit.)

 3. Data is getting swapped to the hard drive, and my hard drive is
 slower than his. I chose a slower hard drive to get bigger capacity for
 the price.

 This is not intended to be an OMG MACOS = TEH R0X0R thread. I'm just
 trying to explain the discrepency.

 Thanks!

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] useR! 2007 --- Call for papers and posters

2007-03-10 Thread Ranjan Maitra
Di,

You probably wanted to say first useR! (hosted) in North America, isn't that 
right?

Anyway, I was wondering: what are the conditions for submitting a paper? Are 
the guidelines the same as JSS (or are they bringing it out)? If I can figure 
out how to make R packages, I might submit a paper on a package.

Ranjan

On Fri, 9 Mar 2007 15:26:24 -0600 Dianne Cook [EMAIL PROTECTED] wrote:

 R Users and Developers,
 
 The first North American useR! will be held at Iowa State University,  
 Ames, Iowa, August 8___10, 2007. Information about the meeting can be  
 found at http://www.user2007.org/.
 
 We are now ready to accept paper and poster submissions.
 
 Papers are encouraged in all areas, but particular emphasis is given  
 to work describing newly created or improved R packages. Papers will  
 be refereed and a best paper/presentation award is likely. Your full  
 paper needs to be submitted by April 23, 5:00PM CST, to be considered  
 for the meeting.
 
 There will also be the opportunity to present your work as a poster  
 instead of a paper. Poster submissions will be in the form of an  
 abstract and needs to be submitted by June 30.
 
 Submit full papers, and poster abstracts, to [EMAIL PROTECTED]
 
 useR! Program Committee
 [EMAIL PROTECTED]
 
 ___
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-announce
 
 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Off topic:Spam on R-help increase?

2007-03-10 Thread François Pinard
[Marc Schwartz]

The Human Spam Filter (aka Martin) [...]

The R mailing list has, indeed, be remarkably spam-free, and 
well-managed so far that I can see.  I do hope, however, that Martin 
does not have to do the filtering himself -- it would be just daunting!

In any case, Martin, a lot of thanks from me!

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
R-help@stat.math.ethz.ch 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] RMySQL on win32

2007-03-10 Thread Pete Cap
List,

I just left an environment where I was running R and mysql on CENTOS.  At the 
time of install, RMySQL was available on CRAN.  Later installs on Ubuntu were 
possible because it was available as a package in the base repos.

Now I'm in a new environment where I have no choice but to use Windows XP.  I 
have just installed R 2.4.1 and MySQL 5.0.27.  The installation instructions 
for getting RMySQL to install are a bit dense and possibly over my head, so I'm 
wondering if it is really necessary to compile the package against my current 
versions (yes, I realize that may be a question with a painfully obvious 
answer), or if I can simply use one of the precompiled binaries at David 
James's site.  If anyone can tell me (or if there is a very easy way to get 
RMySQL up and running on win32), please let me know.

As an aside, can anyone explain why it is not possible to keep that package in 
CRAN?  I'm just curious about that, it's just for my own enlightenment.

Thanks,

Pete

 
-
Don't get soaked.  Take a quick peek at the forecast 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] barplot, for loop?

2007-03-10 Thread jim holtman
Here is one way of doing it.


x - 'kuvaaja kuva yhteispisteet
Hannu isokala 8
Hannu kaapin alta löytynyt 2
Hannu kaapin alta löytynyt2 8
Hannu limamikko 1
Hannu maukasta marmeladia 8
Hannu skrinnareita 4
Hate madekoukkujen suojelupyhimys 3
Hate matka aikaan joka ei enää palaa 3
Hate munat puoliks padassa 6
Hate pyynikki 2
Hate vailla armeerausta 2
Lassi ajatelkaa, jos Häntä ei olisikaan 2
Lassi elämän viiva 7
Lassi pedot 1
Lassi portsan kundi 3
Lauri hipö 3
Lauri jääpuut 5
Lauri kökar 3
Lauri lumipuu 9
Petteri harmaaleppä 5
Petteri viileä harakka 2
Teemu harppi 2
Teemu Homo sapiens angelus 3
Teemu kainostelua 1
Teemu pinnalla 5
Teemu portinvartija 6
Teemu puikot 1
Teemu verkkovaja 3'
# read in the data
x.in - read.table(textConnection(x), header=TRUE)
# split data by groups
x.ku - split(x.in, x.in$kuvaaja)

# iterate through each group
for (i in names(x.ku)){
# sort the data in decending order
.order - rev(order(x.ku[[i]]$yhteispisteet))
# plot it
barplot(x.ku[[i]]$yhteispisteet[.order],
  names.arg=as.character(x.ku[[i]]$kuva[.order]),
  las=3,
  cex.names=0.8,
  main=i,
  ylim=c(0,10)
  )
}






On 3/10/07, Lauri Nikkinen [EMAIL PROTECTED] wrote:

 Hi R-users,



 I have a dataset like this:



 kuvaaja

 kuva

 yhteispisteet

 Hannu

 isokala

 8

 Hannu

 kaapin alta löytynyt

 2

 Hannu

 kaapin alta löytynyt 2

 8

 Hannu

 limamikko

 1

 Hannu

 maukasta marmeladia

 8

 Hannu

 skrinnareita

 4

 Hate

 madekoukkujen suojelupyhimys

 3

 Hate

 matka aikaan joka ei enää palaa

 3

 Hate

 munat puoliks padassa

 6

 Hate

 pyynikki

 2

 Hate

 vailla armeerausta

 2

 Lassi

 ajatelkaa, jos Häntä ei olisikaan

 2

 Lassi

 elämän viiva

 7

 Lassi

 pedot

 1

 Lassi

 portsan kundi

 3

 Lauri

 hipö

 3

 Lauri

 jääpuut

 5

 Lauri

 kökar

 3

 Lauri

 lumipuu

 9

 Petteri

 harmaaleppä

 5

 Petteri

 viileä harakka

 2

 Teemu

 harppi

 2

 Teemu

 Homo sapiens angelus

 3

 Teemu

 kainostelua

 1

 Teemu

 pinnalla

 5

 Teemu

 portinvartija

 6

 Teemu

 puikot

 1

 Teemu

 verkkovaja

 3



 I have done this:



 pisteet.hannu - subset(pisteet.sum, kuvaaja == Hannu, select=c(kuva,
 yhteispisteet))

 (pisteet.hannu - pisteet.hannu[rev(order(pisteet.hannu$yhteispisteet)),])

 pisteet.lauri - subset(pisteet.sum, kuvaaja == Lauri, select=c(kuva,
 yhteispisteet))

 (pisteet.lauri - pisteet.lauri[rev(order(pisteet.lauri$yhteispisteet)),])

 pisteet.lassi - subset(pisteet.sum, kuvaaja == Lassi, select=c(kuva,
 yhteispisteet))

 (pisteet.lassi - pisteet.lassi[rev(order(pisteet.lassi$yhteispisteet)),])

 pisteet.teemu - subset(pisteet.sum, kuvaaja == Teemu, select=c(kuva,
 yhteispisteet))

 (pisteet.teemu - pisteet.teemu[rev(order(pisteet.teemu$yhteispisteet)),])

 pisteet.petteri - subset(pisteet.sum, kuvaaja == Petteri,
 select=c(kuva,
 yhteispisteet))

 (pisteet.petteri - pisteet.petteri[rev(order(
 pisteet.petteri$yhteispisteet
 )),])

 pisteet.hate - subset(pisteet.sum, kuvaaja == Hate, select=c(kuva,
 yhteispisteet))

 (pisteet.hate - pisteet.hate[rev(order(pisteet.hate$yhteispisteet)),])



 opar - par(mfrow=c(2,3), mar=c(11,3,3,3))



 barplot(as.vector(pisteet.hannu$yhteispisteet),

names.arg=as.vector(pisteet.hannu$kuva),

las=3,

cex.names=0.8,

main=Hannu,

ylim=c(0,10)

)

 barplot(as.vector(pisteet.lauri$yhteispisteet),

names.arg=as.vector(pisteet.lauri$kuva),

las=3,

cex.names=0.8,

main=Lauri,

ylim=c(0,10)

)

 barplot(as.vector(pisteet.lassi$yhteispisteet),

names.arg=as.vector(pisteet.lassi$kuva),

las=3,

cex.names=0.8,

main=Lassi,

ylim=c(0,10)

)

 barplot(as.vector(pisteet.teemu$yhteispisteet),

names.arg=as.vector(pisteet.teemu$kuva),

las=3,

cex.names=0.8,

main=Teemu,

ylim=c(0,10)

)

 barplot(as.vector(pisteet.petteri$yhteispisteet),

names.arg=as.vector(pisteet.petteri$kuva),

las=3,

cex.names=0.8,

main=Petteri,

ylim=c(0,10)

)

 barplot(as.vector(pisteet.hate$yhteispisteet),

names.arg=as.vector(pisteet.hate$kuva),

las=3,

cex.names=0.8,

main=Hate,

ylim=c(0,10)

)

 par(opar)


 Queston is: how do I do this more effectively e.g. using for loop (without
 subsetting, straight from the original data)? Thanks in advance!

 -Lauri

[[alternative HTML version deleted]]


 __
 R-help@stat.math.ethz.ch 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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]


Re: [R] Mac vs. PC

2007-03-10 Thread Thomas Lumley
On Fri, 9 Mar 2007, Richard Morey wrote:
 1. R on Mac was compiled with optimizations for the CPU, with R for
 Windows was not. I could test this by compiling R with the Intel
 compiler, or GCC with optimizations, and seeing if I get a significant
 speed boost.

Yes.  The Mac distribution uses Apple's linear algebra library, which is 
based on ATLAS and uses both cores.  The default Windows distribution 
doesn't use an optimized linear algebra library because there isn't one 
built in to Windows.  You can use ATLAS with the Windows distribution and 
there are even precompiled DLLs around somewhere.

 2. His R is 64 bit, while mine is for 32 bit windows. (I'm not sure how
 much of a diference that makes, or whether OSX is 64 bit.)

No.

His R isn't 64bit.  It would probably be slower if it were. The main 
reason to want 64bit R is to use lots of memory rather than to be fast.

 3. Data is getting swapped to the hard drive, and my hard drive is
 slower than his. I chose a slower hard drive to get bigger capacity for
 the price.

This could be true in principle, but I don't think the matrices are large 
enough for it to be the main factor.


His computer won't be twice as fast on most R tasks (though it will still 
be twice as pretty, of course).

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch 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] RMySQL on win32

2007-03-10 Thread Uwe Ligges


Pete Cap wrote:
 List,
 
 I just left an environment where I was running R and mysql on CENTOS.
 At the time of install, RMySQL was available on CRAN.  Later installs
 on Ubuntu were possible because it was available as a package in the
 base repos.
 
 Now I'm in a new environment where I have no choice but to use
 Windows XP.  I have just installed R 2.4.1 and MySQL 5.0.27.  The
 installation instructions for getting RMySQL to install are a bit
 dense and possibly over my head, so I'm wondering if it is really
 necessary to compile the package against my current versions (yes, I
 realize that may be a question with a painfully obvious answer), or
 if I can simply use one of the precompiled binaries at David James's
 site.  If anyone can tell me (or if there is a very easy way to get
 RMySQL up and running on win32), please let me know.
 
 As an aside, can anyone explain why it is not possible to keep that
 package in CRAN?  I'm just curious about that, it's just for my own
 enlightenment.

For CRAN, I could only build against one version of MySQL for each 
version of R. In the past (particularly up to R-1.6.x), Brian Ripley 
made some bad experiences with incompatibilities when the package was 
built using different versions of MySQL. Hence we do not want to provide 
builds to the public that might only work together with some particular 
versions of MySQL.

Best,
Uwe




 
 Thanks,
 
 Pete
 
 
 - Don't get soaked.  Take a quick
 peek at the forecast
 
 [[alternative HTML version deleted]]
 
 __ 
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Off topic:Spam on R-help increase?

2007-03-10 Thread Marc Schwartz
On Sat, 2007-03-10 at 10:17 -0500, François Pinard wrote:
 [Marc Schwartz]
 
 The Human Spam Filter (aka Martin) [...]
 
 The R mailing list has, indeed, be remarkably spam-free, and 
 well-managed so far that I can see.  I do hope, however, that Martin 
 does not have to do the filtering himself -- it would be just daunting!
 
 In any case, Martin, a lot of thanks from me!

The comment was somewhat tongue-in-cheek.

While a major proportion of spam can be filtered using automated tools,
it takes a significant amount of manual effort to configure the tools to
achieve the level of cleansing that we observe here.

On my system (laptop running FC6 Linux), I am using SpamAssassin with
Bayesian filtering enabled, along with remote spam checks such as DCC,
Razor, Pyzor and some RBLs. 

I also recently started using FuzzyOCR (as a plug-in to SA) to enhance
the filtering of spam containing only graphic content. These e-mails are
of course specifically designed to obviate the utility of text based
spam filtering.

However, I still get some that come through despite the above. There are
also 'borderline' e-mails that require manually running the spam/ham
learning scripts.

To increase the filtering effectiveness to the level we see here, I
would have to spend a fair amount of time writing custom rules for SA
and this is where I have no doubt, Martin spends a lot of his time with
list management.

HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch 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] finding max into matrix

2007-03-10 Thread Milton Cezar Ribeiro
Dear r-friends,

Starting from a random position of a matrix, I would like find the position 
(index) of max values using 3x3 and 5x5 windows. Just supose that I have 
something like:

set.seed(1)
my.values-round(runif(441)*21,0)
my.matrix-matrix(my.values,21)
image(my.matrix,xaxs=r,yaxs=r,col=heat.colors(10))
start.pos-c(0.5,0.5) # this position are c(11,11)
points(start.pos[1]~start.pos[2])

So I would like to see what are the values great than the value of my current 
position, and go for the position where the value are great. When the greatest 
value are present on more than one neighbour position, so I would like use a 
5x5 window to decide how path could help me to maximize the value.

From a random position, I will stop when no more values (using 3x3 and 5x5 
windows) are great than the position that I reach up.

I know that there are some GIS solutions that do this, but I really need use R 
to implement in a package that I am programing now.

Kind regards,

miltinho

__


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] xtable with dupplicate rownames

2007-03-10 Thread Anirudh V. S. Ruhil
I have  a table (tab5; see below) with the first block showing the counts 
in a cross-tabulation, and the lower block reflecting the proportions of 
interest.

 tab5
 None Low Level Moderate Intense Very Intense Total
None 0.00  3.00 0.000.00 1.00 4
Low Level1.00  2.00 0.000.00 0.00 3
Moderate 2.00  3.00 2.000.00 0.00 7
Intense  3.00  1.00 1.001.00 0.00 6
Very Intense 0.00  1.00 2.000.00 0.00 3
Total6.00 10.00 5.001.00 1.0023
None 0.00  0.75 0.000.00 0.25 1
Low Level0.33  0.67 0.000.00 0.00 1
Moderate 0.29  0.43 0.290.00 0.00 1
Intense  0.50  0.17 0.170.17 0.00 1
Very Intense 0.00  0.33 0.670.00 0.00 1

When I execute
foo5 - xtable(format(tab5), caption = XYZ)

I get the following error message
Warning message:
some row.names duplicated: 7,8,9,10,11 -- row.names NOT used in: 
data.row.names(row.names, rowsi, i)

Is there any way to force the duplicate row-names to be retained in xtable?

Alternatively, is there a succinct way of building a cross-tabulation with 
both counts and proportions in each cell, and then using xtable?

thanks for any and all tips

Ani

Anirudh V. S. Ruhil, Ph.D.
Sr. Research Associate
Voinovich Center for Leadership and Public Affairs
Ohio University
Building 21, The Ridges
Athens, OH 45701-2979
Tel: 740.597.1949 | Fax: 740.597.3057

__
R-help@stat.math.ethz.ch 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] Using large datasets: can I overload the subscript operator?

2007-03-10 Thread rdporto1
Maciej,

 I think it should be possible to make a package (call it slice) that could
 be used like this:
 ...
 Has anyone ever made a similar extension, with virtual (lazy) arrays?


take a look at the filehash package at
http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf

Regards,

Rogerio

__
R-help@stat.math.ethz.ch 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] curve of density on histogram

2007-03-10 Thread Ted Harding
On 08-Mar-07 Duncan Murdoch wrote:
 
 On 3/8/2007 11:29 AM, (Ted Harding) wrote:
 
 On 08-Mar-07 KOITA Lassana - STAC/ACE wrote:
 
 [snip]
 
 [snip]
 The argument N to sdnorm is readily available from the argument x,
 as N = length(x).
 
 However, I cannot work out from the documentation for these panel
 functions how to determine the width of the histogram bins, which
 is argument binwid to sdnorm(). Hence I have simply set binwid=0.l0
 to illustrate the point, since this gives an approximately correct
 plot. But it will only be really correct when binwid can somehow
 be determined from the hosyogram being plotted, and it is this
 which I cannot see!
 
 
 The breaks are one of the ... args passed to the panel function, so you
 can get the binwidth from there.  But there's another problem:  the 
 panel.histogram function gives percent of total, so should integrate to
 100, not to N.  I think this version gives what is wanted:
 
 library(lattice)
 library(grid)
 resp  - rnorm(2000)
 group - sample(c(G1, G2, G3, G4), replace = TRUE, size = 1000)
 New function sdnorm:
 sdnorm
 -function(x,mean=0,sd=1,N=1,binwid=1){N*binwid*dnorm(x,mean,sd)}
 histogram(~ resp | group, col=steelblue,
panel = function(x, ...){
  std - if(length(x)  0) format(round(sd(x), 2), nsmall = 2) else
 NA
  n - length(x)
  m - if(length(x)  0) format(round(mean(x), 2), nsmall = 2) else
 NA
  panel.histogram(x, ...)
 
 
  breaks - list(...)$breaks
  binwid - breaks[2]-breaks[1]
  panel.mathdensity(dmath = sdnorm, col = green,
args = 
 list(mean=mean(x),sd=sd(x),N=100,binwid=breaks[2]-breaks[1]))
 
 
  panel.abline(v= mean(x), col = red)
  panel.abline(h=5)
  panel.xyplot(x = jitter(x),type=p,pch=20,y = rep(0, length(x)),
 col='yellow' )
 
  x1 - unit(1, npc) - unit(2, mm)
  y1 - unit(1, npc) - unit(2, mm)
  grid.text(label = bquote(n == .(n)), x = x1, y = y1, just =
 right)
  grid.text(label = bquote(hat(m) == .(m)), x = x1, y = y1 - unit(1,
 lines), just = right)
  grid.text(label = bquote(hat(s) == .(std)), x = x1, y = y1 -
 unit(2, lines), just = right)
 })

Duncan, your statement that But there's another problem:  the 
panel.histogram function gives percent of total, so should integrate
to 100, not to N got me challenged -- there must be a work-round!

Finally I found it, but you have to make the change in (to me)
an unexpected place.

The following code (your code above, with two changed lines commented
out, and followed by the changed version) really does do the intended
job of plotting a panel of histograms of *counts* with the appropriate
scaled normal densities superimposed.


library(lattice)
library(grid)
N-2
resp  - rnorm(N)
group - sample(c(G1, G2, G3, G4), replace = TRUE, size = N/4)
 New function sdnorm:
sdnorm -function(x,mean=0,sd=1,N=1,binwid=1){N*binwid*dnorm(x,mean,sd)}

##Changed line
 histogram(~ resp | group, col=steelblue,
histogram(~ resp | group, col=steelblue, type=count,
   panel = function(x, ...){
 std - if(length(x)  0) format(round(sd(x), 2), nsmall = 2) else
NA
 n - length(x)
 m - if(length(x)  0) format(round(mean(x), 2), nsmall = 2) else
NA
 panel.histogram(x, ...)


 breaks - list(...)$breaks
 binwid - breaks[2]-breaks[1]
 panel.mathdensity(dmath = sdnorm, col = green,
   args =
## Changed line
 list(mean=mean(x),sd=sd(x),N=100,binwid=breaks[2]-breaks[1]))
list(mean=mean(x),sd=sd(x),N=length(x),binwid=breaks[2]-breaks[1]))

 panel.abline(v= mean(x), col = red)
 panel.abline(h=5)
 panel.xyplot(x = jitter(x),type=p,pch=20,y = rep(0, length(x)),
col='yellow' )

 x1 - unit(1, npc) - unit(2, mm)
 y1 - unit(1, npc) - unit(2, mm)
 grid.text(label = bquote(n == .(n)), x = x1, y = y1, just = right)
 grid.text(label = bquote(hat(m) == .(m)), x = x1, y = y1 - unit(1,
lines), just = right)
 grid.text(label = bquote(hat(s) == .(std)), x = x1, y = y1 -
unit(2, lines), just = right)
})


I first tried setting type=count in the call to panel.histogram(),
as in

  panel.histogram(x, type=count, ...)

but this got me an error message

  Error in panel.histogram(x, type = count, ...) : 
formal argument type matched by multiple actual arguments

from which I (slowly) deduced that it had already got that parameter
from somewhere else, after which it seemed natural that it got it
from the preceding call to

  histogram(~ resp | group, col=steelblue,
[etc]

so I tried setting it there and (with the factor N-length(x) for
counts, instead of 100 for percentage) this worked!

(And I confess, when I posted my first suggestion, that I had
omitted to read the vertically aligned small print at the side
of the panel which said Percent of Total!).

Ah well, it's been an interesting little tour!

Thanks for the breakthrough, Duncan!
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 

Re: [R] About cex=: how to improve resolution?

2007-03-10 Thread Greg Snow
Use the symbols function!


-Original Message-
From: Luca Quaglia [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch
Sent: 3/9/07 2:55 PM
Subject: [R] About cex=: how to improve resolution?

Hi,

I need to plot a graph with a circle of radius 1 and
with a series of points of different size. The size of
these points compared to the fixed circle is important
and bears a meaning.

Here is the a simplified version of the code I'm
using:

x-seq(0,2,by=0.2)
y-x
z-seq(0,1,by=0.1)
angle-pi/180*c(0:359)
par(pty=s)
plot(-2:2,-2:2,type=n)
lines(cos(angle),sin(angle))
points(x,y,cex=z)

I obtain points of the same size when
cex=0.1/0.2/0.3/0.4 or cex=0.5/0.6/0.7 or
cex=0.8/0.9/1.0.

Please, does anyone know if there is a way of
improving the resolution of cex in order to have 10
points *all* of different size (respecting the above
written different values of cex)? The circle is fixed
of radius 1 and the values of cex are in relation with
that and they shouldn't be modified.

Thanks, Luca

__
R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] xtable with dupplicate rownames

2007-03-10 Thread Anirudh V. S. Ruhil
I patched a solution together; essentially by using cbind to stack the 
proportions as columns. Duplicate columns names appear to pose no problems 
for xtable but duplicate rownames do!



--On Saturday, March 10, 2007 1:11 PM -0500 Anirudh V. S. Ruhil 
[EMAIL PROTECTED] wrote:

: I have  a table (tab5; see below) with the first block showing the counts
: in a cross-tabulation, and the lower block reflecting the proportions of
: interest.
:
: tab5
:  None Low Level Moderate Intense Very Intense Total
: None 0.00  3.00 0.000.00 1.00 4
: Low Level1.00  2.00 0.000.00 0.00 3
: Moderate 2.00  3.00 2.000.00 0.00 7
: Intense  3.00  1.00 1.001.00 0.00 6
: Very Intense 0.00  1.00 2.000.00 0.00 3
: Total6.00 10.00 5.001.00 1.0023
: None 0.00  0.75 0.000.00 0.25 1
: Low Level0.33  0.67 0.000.00 0.00 1
: Moderate 0.29  0.43 0.290.00 0.00 1
: Intense  0.50  0.17 0.170.17 0.00 1
: Very Intense 0.00  0.33 0.670.00 0.00 1
:
: When I execute
:   foo5 - xtable(format(tab5), caption = XYZ)
:
: I get the following error message
:   Warning message:
:   some row.names duplicated: 7,8,9,10,11 -- row.names NOT used in:
:   data.row.names(row.names, rowsi, i)
:
: Is there any way to force the duplicate row-names to be retained in
: xtable?
:
: Alternatively, is there a succinct way of building a cross-tabulation
: with  both counts and proportions in each cell, and then using xtable?
:
: thanks for any and all tips
:
: Ani
:
: Anirudh V. S. Ruhil, Ph.D.
: Sr. Research Associate
: Voinovich Center for Leadership and Public Affairs
: Ohio University
: Building 21, The Ridges
: Athens, OH 45701-2979
: Tel: 740.597.1949 | Fax: 740.597.3057
:
: __
: R-help@stat.math.ethz.ch 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.



Anirudh V. S. Ruhil, Ph.D.
Sr. Research Associate
Voinovich Center for Leadership and Public Affairs
Ohio University
Building 21, The Ridges
Athens, OH 45701-2979
Tel: 740.597.1949 | Fax: 740.597.3057

__
R-help@stat.math.ethz.ch 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] Dyn.load and Unload problems

2007-03-10 Thread Saptarshi Guha
Hi,
I am trying to modify the devX11.c source in the directory R-2.4.1/ 
src/modules/X11.
Under OS X 10.4.9 running the R gui (R version 2.4.1) on a  
Powerbook, i type this and get the subsequent error.

 dyn.unload(/Library/Frameworks/R.framework/Resources/modules/ppc/ 
R_X11.so)
Error in dyn.unload(x) : dynamic/shared library '/Library/Frameworks/ 
R.framework/Resources/modules/ppc/R_X11.so' was not loaded

Yet, when i type the same line in terminal R, it works.

Q1: How do find out what dlls have been loaded?

Q2. In terminal R (with X11.app not running) , i unloaded R_X11.so  
(as above), which worked. I then loaded my own R_X11_b.so (displaying  
warning messages).
I then unloaded this one and following occurred
a) I ran X11() - it still ran, displaying my warnings - but it  
shouldn't have run since i unloaded all the R_X11.so (mine and R's)
b)upon modifying the warning messages (again) and reloading, the  
warning messages don't reflect those of the new compiled devX11.c
e.g in R_init_R_X11, which runs upon the so file being loaded, did  
not display the  modified warning messages - it showed the old ones  
(in (a))


I would appreciate any help on this matter
Rgds
Saptarshi


This R.version (identical for both the GUI and commandline versions)
platform   powerpc-apple-darwin8.8.0
arch   powerpc
os darwin8.8.0
system powerpc, darwin8.8.0
status
major  2
minor  4.1
year   2006
month  12
day18
svn rev40228
language   R
version.string R version 2.4.1 (2006-12-18)

__
R-help@stat.math.ethz.ch 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] Mac vs. PC

2007-03-10 Thread R. Villegas
2007/3/10, Richard Morey [EMAIL PROTECTED]:
 My adviser has a Mac notebook that he bought 6 months ago, and I have a
 PC notebook I bought a month ago. Here are the respective specs, as far
 as I know them:

 His:
 Mac OSX
 1 GB DDR2 RAM
 Intel Core Duo, 2 GHz (2MB cache per core)
 Unknown HD

 Mine
 Windows Vista Home Premium 32bit
 2 GB DDR2 RAM
 Intel Core 2 Duo, 2 GHz (4MB cache)
 5400 RPM Hard Drive


 We are both running R. As a test to see whose laptop was faster, we
 decided to invert large random matrices. In R language, it looks like this:

 N=2000
 A=rnorm(N^2)
 A=matrix(A,ncol=N)
 solve(A)

 This creates a matrix of 4,000,000 random normal deviates and inverts
 it. His computer takes about 7 seconds, while mine takes about 14. Why
 the difference? I have several working hypotheses, and it would be
 interesting to see what you guys think.

 1. R on Mac was compiled with optimizations for the CPU, with R for
 Windows was not. I could test this by compiling R with the Intel
 compiler, or GCC with optimizations, and seeing if I get a significant
 speed boost.

 2. His R is 64 bit, while mine is for 32 bit windows. (I'm not sure how
 much of a diference that makes, or whether OSX is 64 bit.)

 3. Data is getting swapped to the hard drive, and my hard drive is
 slower than his. I chose a slower hard drive to get bigger capacity for
 the price.

 This is not intended to be an OMG MACOS = TEH R0X0R thread. I'm just
 trying to explain the discrepency.

 Thanks!

 __
 R-help@stat.math.ethz.ch 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.


Hi,

For Windows you can check versions of Rblas.dll linked against the
ATLAS library:
http://cran.r-project.org/bin/windows/contrib/ATLAS/

Rod.

__
R-help@stat.math.ethz.ch 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.