Re: [R] R CMD BATCH command

2007-06-06 Thread Prof Brian Ripley
On Tue, 5 Jun 2007, Peter Dalgaard wrote:

 Austin, Peter wrote:
 The version of R on our unix system has been updated to version 2.5.0.
 When I type the following command at the unix prompt:

 'R CMD BATCH filename'

 I receive the following error message:

 Error in Sys.unsetenv(R_BATCH) : 'Sys.unsetenv' is not available on
 this system

 Execution halted.



 'R CMD BATCH filename' used to work with the prior version of R that I
 had installed (version 2.2.0). Is there something that I need to modify
 for it to work now?

 Thanks,

 Peter


 A similar problem was found on an old version of Solaris and discussed
 on this very list on May 14 (use the list archive and look for the
 thread started by Simon Penel). This could be similar to your problem
 (but you omitted to tell us what system you were on).

And that problem has been fixed in R-patched, so please try R-patched.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] correspondence analysis

2007-06-06 Thread Artem Mariupol
Hello,

I am new to R and I have a question about the difference between
correspondence analysis in R and SPSS.
This is the input table I am working with (4 products and 18 attributes):

 mytable
   1  2  3  4  5 6  7  8  9 10 11 12 13 14 15 16 17 18
1 15 11 20  4 14 7  1  2  1  4 12 12 17 19 11 20  9 10
2 19 18 14 14 16 4 14 11 11 15 22 19 22 16 21 19 15 16
3 16 13 10  9 15 4 10  7 11 13 18 17 14 14 16 16 13 11
4 21 18 16 14 20 6 12 14 14 17 23 20 19 18 21 18 19 18

I found the function corresp() in the package MASS, but the results are
different from the output in SPSS. Also, I don't understand the coordinates;
in the biplot I cannot find a -2 limit for example from the first product on
any of the x axes.

 Rresult - corresp(mytable, nf=2)
 Rresult
First canonical correlation(s): 0.20823373 0.04840434

 Row scores:
[,1][,2]
1 -2.0838424  0.01237391
2  0.4901559  1.51190922
3  0.4463375 -0.72631884
4  0.4946202 -0.87620237

 Column scores:
  [,1][,2]
1  -0.29870621 -0.32282847
2   0.04851042  0.73570925
3  -1.79584803  0.04537505
4   1.10904141  1.21563470
5  -0.35048140 -1.28883782
6  -1.80044987 -1.99532989
7   1.96987033  1.89925225
8   1.59225423 -0.42249233
9   1.96534193 -2.01733348
10  1.29641406 -0.67857429
11  0.33216906  0.05071065
12  0.12620111 -0.30281237
13 -0.59997905  1.90985228
14 -1.18972391 -0.46697874
15  0.34099302  0.55835672
16 -1.07356465  0.44743219
17  0.32569239 -1.21741819
18  0.07133121  0.20777127

Thank you for your patience.
am

[[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] rJava installation under linux: configuration failed

2007-06-06 Thread Stefan Grosse
Which java have you installed? ( java -version )

You need a Sun Java and better is a 1.5 series Java, JGR seems to have
some problem with the new 1.6 series. And you need the JDK, not the JRE.

You can google how to do those installations on suse linux.

Stefan

 Original Message 
Subject: [R] rJava installation under linux: configuration failed
From: zhihua li [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date: 05.06.2007 19:55
 Hi netter,

 Recently I was trying to install rJava. The operating system is suse
 10.0, and the R versionis 2.5.0.

 Following the instructions of R Wiki for rJava, I did configuration
 first: R CMD javareconf

 and then it showed a series of information, from what it seems that
 java is in the system and the configuration succeeded.

 Then I tried to install rJava:
 install.packages(rJava)

 following which rJava was downloaded and being installed, but during
 the last test step it said: can't complie a simple JNL program.
 Configuration Failed!

 Did I do something wrong? Or there's something I should do that I didn't?

 Thanks a lot!


 Sincerely Yours: Zhihua Li

 

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

 No virus found in this incoming message.
 Checked by AVG Free Edition. 
 Version: 7.5.472 / Virus Database: 269.8.9/834 - Release Date: 05.06.2007 
 14:38


__
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] multiple plot in odfWeave

2007-06-06 Thread Laurence Amilhat
Hello Max,

Thanks for your help.
So, I changed the  = with

carte2, echo = FALSE, results=XML, fig = TRUE=


So , now I can open the output file .odt, but it plot only the last map
and not all the maps.
But on the R graphics window, i can see the several maps overwrite each 
other.
Maybe there is something wrong in my loop?

I attached to this message a file with 2 projects, on different points 
to map foreach projects


Thanks,

Laurence


here is the code:

Connection, echo = FALSE, results=XML =

library(RMySQL)
library(maps)
library(mapdata)
library(spmaps)
library(grid)
library(plotrix)

drv - dbDriver(MySQL)

con - dbConnect(drv, user=user, password=, dbname=Aquagenome, 
host=toulouse.inra.fr, client.flag=CLIENT\_MULTI\_STATEMENTS)

@

Liste des projets:

carte2, echo = FALSE, results=XML, fig = TRUE=

lp - dbSendQuery(con, SELECT nom FROM projets)
projets - fetch(lp)
nbr=dim(projets)[1]

for (i in 1:nbr)

{
monprojet=(projets)[i,1]
myquery=paste(SELECT s.longitude, s.latitude, o.orgashort FROM 
organisme o JOIN scientist s ON o.codeorga=s.codeorga JOIN partenaire p 
ON p.codescientist=s.codescientist JOIN projets ON 
projets.codeproj=p.codeproj WHERE projets.nom LIKE \',monprojet,\' 
ORDER BY s.longitude, sep=)

rs - dbSendQuery(con, myquery)
df - fetch(rs)

map(database=world, xlim=c(-15,40),ylim=c(27,71), fill=TRUE, 
col=#CC)
points(df$longitude,df$latitude, col=red, pch=16)
spread.labels(df$longitude,df$latitude,df$orgashort,0,bg=#CC, 
border=TRUE, cex=0.8, xpad=0.5, ypad=0.8, font=6)

}

@

toto




Here is the result of the sessionInfo()

  sessionInfo()
R version 2.5.0 (2007-04-23)
i686-pc-linux-gnu

locale:
[EMAIL PROTECTED];LC_NUMERIC=C;[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
PROTECTED];[EMAIL PROTECTED];[EMAIL 
PROTECTED];LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;[EMAIL 
PROTECTED];LC_IDENTIFICATION=C

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

other attached packages:
 plotrix   spmaps   sp  mapdata maps   RMySQL  DBI odfWeave
   2.2  0.1-4 0.9-13 2.0-20 2.0-36 0.5-11  0.2-3  0.4.9
 lattice
0.15-4

Kuhn, Max a écrit :
 Laurence,

 I haven't seen any issues like this. Can you:

   1. Send the results of sessionInfo()

   2. Try using carte2, echo = FALSE, results= xml, fig = TRUE=. It
 sounds like the text being written to the xml file is not valid xml.
 This could be the case if results != xml.

   3. If that doesn't work, send me a data object and the odt file so
 that I can try to reproduce the error?  

 Max

 --
 LEGAL NOTICE
 Unless expressly stated otherwise, this message is confidential and may be 
 privileged.  It is intended for the addressee(s) only.  Access to this E-mail 
 by anyone else is unauthorized.  If you are not an addressee, any disclosure 
 or copying of the contents of this E-mail or any action taken (or not taken) 
 in reliance on it is unauthorized and may be unlawful.  If you are not an 
 addressee, please inform the sender immediately.
   


-- 

= Laurence AmilhatINRA Toulouse 31326 Castanet-Tolosan = 
= Tel: 33 5 61 28 53 34   Email: [EMAIL PROTECTED] =





[[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] odfTable

2007-06-06 Thread Laurence Amilhat
Great,

I will waiting for the new version... with the nice documentation!

thank you,

Laurence.


Kuhn, Max a écrit :
 Sarah and Laurence,

 A few comments:

   1. The default background color for columns is horrible. I've changed
 to white it in the upcoming version.

   2. In the next version (in 1-2 weeks), I have a fairly long document
 that goes into much more detail about the specific styles that can be
 changed and examples.

   3. To simply Sarah's approach, add the style definition via
 setStyleDefs(existingStyles) as suggested. Then, just before making the
 table, simply use

 current - getStyles()
 currrent$header - newStyle1
 setStyles(current)

  then produce the table. Unless I'm not understanding what you want,
 you shouldn't need to use tableStyles.

 If anyone wants the new version while I finish a few of the
 documentation pages, send me an email off-list and I'll send it to you.

 Thanks,

 Max

 --
 LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

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


-- 

= Laurence AmilhatINRA Toulouse 31326 Castanet-Tolosan = 
= Tel: 33 5 61 28 53 34   Email: [EMAIL PROTECTED] =

__
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] rJava installation under linux: configuration failed

2007-06-06 Thread Prof Brian Ripley
On Wed, 6 Jun 2007, Stefan Grosse wrote:

 Which java have you installed? ( java -version )

 You need a Sun Java and better is a 1.5 series Java, JGR seems to have
 some problem with the new 1.6 series. And you need the JDK, not the JRE.

Precautionary note: the '1.5 series Java' (aka Java 5) does not work with 
JNI (and hence rJava) on some platforms, including AMD64 Linux.

 You can google how to do those installations on suse linux.

It can be tricky, especially if you need a later Java than your OS version 
supports.


 Stefan

  Original Message 
 Subject: [R] rJava installation under linux: configuration failed
 From: zhihua li [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Date: 05.06.2007 19:55
 Hi netter,

 Recently I was trying to install rJava. The operating system is suse
 10.0, and the R versionis 2.5.0.

 Following the instructions of R Wiki for rJava, I did configuration
 first: R CMD javareconf

 and then it showed a series of information, from what it seems that
 java is in the system and the configuration succeeded.

 Then I tried to install rJava:
 install.packages(rJava)

 following which rJava was downloaded and being installed, but during
 the last test step it said: can't complie a simple JNL program.
 Configuration Failed!

 Did I do something wrong? Or there's something I should do that I didn't?

 Thanks a lot!


 Sincerely Yours: Zhihua Li

 

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

 

 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.5.472 / Virus Database: 269.8.9/834 - Release Date: 05.06.2007 
 14:38




-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] spgrass6 and aggregation

2007-06-06 Thread jessica . gervais

Dear all,


I am exporting grass map into R thanks to the very useful spgrass6 package.

library(spgrass6)

# I have 3 map I am working with a MASK map of a specific area.

# 1) a landuse map
landuse-readRAST6(landuse_mapname_in_grass)

# 2) a catchment map which divide the area in several catchements
catchment-readRAST6(catchement_mapname_in_grass)

# 3) a precipitation map
precipitation-readRAST6(precipitation_mapname_in_grass)


# then I would like to sum the precipitation spatialy over each catchment
and landuse. So, first I cbind all maps with cbind

MAP-cbind(Dear all,

__
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] rJava installation under linux: configuration failed

2007-06-06 Thread Stefan Grosse


 Precautionary note: the '1.5 series Java' (aka Java 5) does not work
 with JNI (and hence rJava) on some platforms, including AMD64 Linux.

 You can google how to do those installations on suse linux.

 It can be tricky, especially if you need a later Java than your OS
 version supports.

Since the Suse Version is 10.0 there is an installation repository
provided by Suse:

http://download.opensuse.org/distribution/SL-10.0-OSS/inst-source-java/

you can add that via Yast and this should then provide Java 5 JDK.
(provided that you are on the correct platform ...)

__
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] opening vignetten

2007-06-06 Thread Schmitt, Corinna
Dear R-Users,

I have a quite stupid question. I load the GO-package with the command
require(GO). Now I want to read the corresponding vignetten but I forgot
the command for opening it.

Please help me, Corinna

__
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] Svar: Re: help with simple R-question

2007-06-06 Thread Rina Miehs
thanks, that works great!!
 
just have another thing...i the same area
What if the class is list instead of array, how can you name the first
unrecognized column?
 
Rina

 John Kane [EMAIL PROTECTED] 06/05/07 3:17 

--- Rina Miehs [EMAIL PROTECTED] wrote:

 hello
  
 what do i write for R to recognize both columns?
  
 In the R-script downunder you can see that i use
 tapply to get my
 information out of my data, and then i need to use
 it as a dataframe
 with both columns! It is like R is using the first
 column as an
 observationnumber or something, how can i change
 that?? 

It is using the names of the variables as rownames.

try 
n.ant - names(antall)
antal1 - data.frame(n.antal1, antal1)


  
  antal1 -tapply(l1$omlob1,l1$farid,length)
  antal1
 1437987  1100  10007995  10008295  10008792 
 10010203  10018703 
 10033401 
 2 3 3 2 3   
  1 1  
   2 
  10048900  10050492  10055897  10076495  10081892 
 10094801  10100692 
 10101395 
 3 1 3 3 6   
  2 5  
  20 
  10101495  10101595  10104692  10113592  10113697 
 10114297  10120797 
 10120897 
 1 5 4 2 6   
 11 1  
   4 
  10121697  10121897  10121997  10133592  10142892 
 10142995  10146495 
 10150497 
16 3 6 1 1   
  6 4  
   4 
  10150692  10157092  10157292  10164792  10170892 
 10171795  10171895 
 10172300 
 5 2 4 4 4   
  4 4  
   1 
  10175195  10187802  10192499  10192897  10198295 
 10200493  10201693 
 10211593 
 1 2 2 3 5   
  1 3  
   5 
  antal1 - data.frame(antal1)
  antal1
   antal1
 14379872
 1100   3
 10007995   3
 10008295   2
 10008792   3
 10010203  NA
 10018703  NA
 10033401   2
 10048900   3
 10050492   1
 10055897   3
 10076495   3
 10081892   6
 10094801   2
 10100692   5
  
 Thanks
 Rina
 
 [[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 ( http://www.r/ )-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.
 



  Get news delivered with the All new Yahoo! Mail.  Enjoy RSS feeds
right on your Mail page. Start today at
http://mrd.mail.yahoo.com/try_beta?.intl=ca 


[[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] naiveBayes other than e1071

2007-06-06 Thread Uwe Ligges
Dear Max,

thanks for your work on this!
I totally agree in all points and have added some check for zero 
variances to my working copy of NaiveBayes.default() which will be 
published in the next klaR release.

   if(!usekernel){
 temp - apply(sapply(tables, function(x) x[,2]), 2,
   function(x) any(!x))
 if(any(temp))
   stop(Zero variances for at least one class in variables: ,
paste(names(tables)[temp], collapse=, ))
   }


Thanks again,
Uwe




Kuhn, Max wrote:
 Saeed and Uwe,
 
 The underlying problem is the distribution of the data. For example:
 
 table(x.x[,91], y.y)
  y.y
  01
   0.000675027 24120
   0.0021848920  481
 
 When the function tries to estimate the distribution of this feature for
 each class, it gets:
 
nb$tables[[91]]
 [,1] [,2]
0 0.0006750270
1 0.0021848920
 
 (Saeed - column 1 contains the means for each class and column 2
 contains the variances)
  
 For class 0, if a new data point for this variable has a value of
 0.000675027, then dnorm(0.000675027, 0.000675027, 0) = Inf (all other
 points have density values of zero). When the data are normalized by
 p(x), this produces a NaN. A few of the predictors have this problem.
 
 There should probably be some sort of check for this, but that might be
 hard to do when usekernel = TRUE. Uwe - do you agree and/or have ideas? 
 
 Good news Saeed! Just use variable 91 and you don't need a model.
 Seriously, you might want to think about these data a bit. Many of them
 are highly skewed and have a large point mass at zero. Modeling the
 conditional probabilities using a normal distribution may not be the
 best idea.
 
 Max
 
 
 -Original Message-
 From: Uwe Ligges [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, June 05, 2007 3:56 PM
 To: Saeed Abu Nimeh
 Cc: Kuhn, Max; r-help@stat.math.ethz.ch
 Subject: Re: [R] naiveBayes other than e1071
 
 
 
 Saeed Abu Nimeh wrote:
 Max,
 Thanks. I have tried it but i keep getting an error:
 Error in as.vector(x, mode) : invalid argument 'mode'
 Do I have to do something specific when using the class column. I
 tried
 both  y.y-as.vector and y.y-as.factor.

 dread-read.table('dataset.csv',sep=,)
 x.x-as.matrix(dread[,2:256])
 y.y-as.vector(dread[,1])
 nb- NaiveBayes(x=x.x,grouping=y.y)
 pred.nb-predict(nb)

 Error in as.vector(x, mode) : invalid argument 'mode'
 
 
 
 Please tell us (according to the posting guide): Which version of R? 
 Which version of klaR? Example data that reproduce the error?
 
 Uwe Ligges
 
 
 
 Thanks,
 Saeed

 Kuhn, Max wrote:
 Saeed,

 There is a version in the klaR package. I recently submitted a change
 to
 the predict function that may be related to your problem. 

 If:

   1. the posterior probabilities (apart from the prior) are being
 approximated by the product of the p(x_i|y_j) and

   2. a lot of predictors are being used

 then posterior probabilities may have values of absolute zero. 

 When the approximation is used, the approximate posterior
 probabilities
 are normalized by their sum (which is zero in such cases).

 The patch in klaR uses the product of the conditional divided by the
 marginal of x_i (per the true formula). I haven't seen the problem
 occur
 with this patch.

 HTH,

 Max

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Saeed Abu
 Nimeh
 Sent: Monday, June 04, 2007 2:45 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] naiveBayes other than e1071

 Hi List,
 Is there a naiveBayes interface other than the one in e1071 package.
 For
 some reason on certain datasets all predicted values are NaN, but it
 predicts well on others.
 Thanks,
 Saeed
 ---
 model - naiveBayes(x.train, y.train, laplace = 3)
 pred - predict(model,x.test,type=raw)

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


 --
 LEGAL NOTICE
 Unless expressly stated otherwise, this message is confidential and
 may be privileged.  It is intended for the addressee(s) only.  Access to
 this E-mail by anyone else is unauthorized.  If you are not an
 addressee, any disclosure or copying of the contents of this E-mail or
 any action taken (or not taken) in reliance on it is unauthorized and
 may be unlawful.  If you are not an addressee, please inform the sender
 immediately.
 __
 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

[R] list

2007-06-06 Thread elyakhlifi mustapha
hello,
I wanna know how to create a list of list if it's possible and if it isn't 
possible how to do without.
thanks.


  
_ 

[[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] opening vignetten

2007-06-06 Thread Stefan Grosse

?vignette


 Original Message  
Subject: [R] opening vignetten
From: Schmitt, Corinna [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date: 06.06.2007 10:41
 Dear R-Users,

 I have a quite stupid question. I load the GO-package with the command
 require(GO). Now I want to read the corresponding vignetten but I forgot
 the command for opening it.

 Please help me, Corinna

 __
 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] list

2007-06-06 Thread David Barron
There's no special method, just create a list in the usual way.  For example:

 l1-list(a=letters[1:5],b=letters[6:10])
 l1
$a
[1] a b c d e

$b
[1] f g h i j

 l2-list(c=LETTERS[1:5],d=LETTERS[6:10])
 l2
$c
[1] A B C D E

$d
[1] F G H I J

 l3-list(l1,l2)
 l3
[[1]]
[[1]]$a
[1] a b c d e

[[1]]$b
[1] f g h i j


[[2]]
[[2]]$c
[1] A B C D E

[[2]]$d
[1] F G H I J



On 06/06/07, elyakhlifi mustapha [EMAIL PROTECTED] wrote:
 hello,
 I wanna know how to create a list of list if it's possible and if it isn't 
 possible how to do without.
 thanks.


   
 _

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



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

__
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] spgrass6 and aggregation (bis)

2007-06-06 Thread jessica . gervais

Dear all,

I have some additionale question concerning the spgrass6 package.

* When you set a region in GRASS, does the readGRASS6 function in R only
load data contained in the zoomed region or the whole map ?

* When you have a MASK map in grass, does the readGRASS6 function in R only
load data contained inside the MASK area ?


Could this be the problem ?

Thanks,

Jessica


3

Dear all,


I am exporting grass map into R thanks to the very useful spgrass6 package.

library(spgrass6)

# I have 3 map I am working with a MASK map of a specific area.

# 1) a landuse map
landuse-readRAST6(landuse_mapname_in_grass)

# 2) a catchment map which divide the area in several catchements
catchment-readRAST6(catchement_mapname_in_grass)

# 3) a precipitation map
precipitation-readRAST6(precipitation_mapname_in_grass)


# then I would like to sum the precipitation spatialy over each catchment
and landuse. So, first I cbind all maps with cbind

MAP-cbind(landuse,catchment,precipitation)

# then I use the aggregate function
SUM-aggregate(MAP[3],by=list(MAP[1],MAP[2]),sum,na.rm=TRUE)
# here is the problem !!!
Error in as.vector(x, mode) : invalid argument 'mode'



I don't find any idea to solve this...

Does anyone has a suggestion ??

Thanks in advance


Jess

__
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] list

2007-06-06 Thread ONKELINX, Thierry
Sure you can.

 list(list(), list(), list())


 library(fortunes)
 fortune(Yoda)

Evelyn Hall: I would like to know how (if) I can extract some of the
information from the summary of my nlme.
Simon Blomberg: This is R. There is no if. Only how.
   -- Evelyn Hall and Simon 'Yoda' Blomberg
  R-help (April 2005)



Cheers,

Thierry


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
[EMAIL PROTECTED]
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] Namens elyakhlifi mustapha
 Verzonden: woensdag 6 juni 2007 10:59
 Aan: R-help@stat.math.ethz.ch
 Onderwerp: [R] list
 
 hello,
 I wanna know how to create a list of list if it's possible 
 and if it isn't possible how to do without.
 thanks.
 
 
   
 __
 ___ 
 
   [[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] Svar: Re: help with simple R-question

2007-06-06 Thread John Kane

--- Rina Miehs [EMAIL PROTECTED] wrote:

 thanks, that works great!!
  
 just have another thing...i the same area
 What if the class is list instead of array, how can
 you name the first unrecognized column?

I am not sure that I understand the question.  You
don't really have an unrecognised column in the
dataframe but an array of rownames ( I don't know how
they are stored).

I think you can do the same thing as you did for the
data.frame but as I say, I am not sure I understand
the question.  Would you post a little example?


  
 Rina
 
  John Kane [EMAIL PROTECTED] 06/05/07 3:17 
 
 --- Rina Miehs [EMAIL PROTECTED] wrote:
 
  hello
   
  what do i write for R to recognize both columns?
   
  In the R-script downunder you can see that i use
  tapply to get my
  information out of my data, and then i need to use
  it as a dataframe
  with both columns! It is like R is using the first
  column as an
  observationnumber or something, how can i change
  that?? 
 
 It is using the names of the variables as rownames.
 
 try 
 n.ant - names(antall)
 antal1 - data.frame(n.antal1, antal1)
 
 
   
   antal1 -tapply(l1$omlob1,l1$farid,length)
   antal1
  1437987  1100  10007995  10008295  10008792 
  10010203  10018703 
  10033401 
  2 3 3 2 3 
  
   1 1  
2 
   10048900  10050492  10055897  10076495  10081892 
  10094801  10100692 
  10101395 
  3 1 3 3 6 
  
   2 5  
   20 
   10101495  10101595  10104692  10113592  10113697 
  10114297  10120797 
  10120897 
  1 5 4 2 6 
  
  11 1  
4 
   10121697  10121897  10121997  10133592  10142892 
  10142995  10146495 
  10150497 
 16 3 6 1 1 
  
   6 4  
4 
   10150692  10157092  10157292  10164792  10170892 
  10171795  10171895 
  10172300 
  5 2 4 4 4 
  
   4 4  
1 
   10175195  10187802  10192499  10192897  10198295 
  10200493  10201693 
  10211593 
  1 2 2 3 5 
  
   1 3  
5 
   antal1 - data.frame(antal1)
   antal1
antal1
  14379872
  1100   3
  10007995   3
  10008295   2
  10008792   3
  10010203  NA
  10018703  NA
  10033401   2
  10048900   3
  10050492   1
  10055897   3
  10076495   3
  10081892   6
  10094801   2
  10100692   5
   
  Thanks
  Rina
  
  [[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 ( http://www.r/
 )-project.org/posting-guide.html
  and provide commented, minimal, self-contained,
  reproducible code.
  
 
 
 
   Get news delivered with the All new Yahoo!
 Mail.  Enjoy RSS feeds
 right on your Mail page. Start today at
 http://mrd.mail.yahoo.com/try_beta?.intl=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.


Re: [R] list

2007-06-06 Thread John Kane

--- elyakhlifi mustapha [EMAIL PROTECTED]
wrote:

 hello,
 I wanna know how to create a list of list if it's
 possible and if it isn't possible how to do without.
 thanks.

Why?  The question is not clear and could mean several
things.  Can you explain a bit?

__
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] Svar: Re: help with simple R-question

2007-06-06 Thread Rina Miehs
 
The left column is boar id number, and the right is the random effect
estimate. I need the numbers in the left column when i merge far1
together with other data.frames based on the id numbers. When i use
ranef the output is the class list and R only sees the intercepts, but i
need a data.frame with 'boar id' and 'niveau', two columns not just
one...
 
fx
 far1 - ranef(resultat1)[1]
 far1
$farid
(Intercept)
1437987   -3.775851e-03
1100  -3.220044e-03
10007995   1.848914e-02
10008295  -4.583903e-03
10008792  -9.518371e-03
10033401  -7.538132e-03
10048900   1.540309e-02
 far1 - as.data.frame(far1)
 far1
   X.Intercept.
1437987   -3.775851e-03
1100  -3.220044e-03
10007995   1.848914e-02
10008295  -4.583903e-03
10008792  -9.518371e-03
10033401  -7.538132e-03
10048900   1.540309e-02
Thanks again
 
Rina


 John Kane [EMAIL PROTECTED] 06/06/07 11:38 

--- Rina Miehs [EMAIL PROTECTED] wrote:

 thanks, that works great!!
  
 just have another thing...i the same area
 What if the class is list instead of array, how can
 you name the first unrecognized column?

I am not sure that I understand the question.  You
don't really have an unrecognised column in the
dataframe but an array of rownames ( I don't know how
they are stored).

I think you can do the same thing as you did for the
data.frame but as I say, I am not sure I understand
the question.  Would you post a little example?


  
 Rina
 
  John Kane [EMAIL PROTECTED] 06/05/07 3:17 
 
 --- Rina Miehs [EMAIL PROTECTED] wrote:
 
  hello
   
  what do i write for R to recognize both columns?
   
  In the R-script downunder you can see that i use
  tapply to get my
  information out of my data, and then i need to use
  it as a dataframe
  with both columns! It is like R is using the first
  column as an
  observationnumber or something, how can i change
  that?? 
 
 It is using the names of the variables as rownames.
 
 try 
 n.ant - names(antall)
 antal1 - data.frame(n.antal1, antal1)
 
 
   
   antal1 -tapply(l1$omlob1,l1$farid,length)
   antal1
  1437987  1100  10007995  10008295  10008792 
  10010203  10018703 
  10033401 
  2 3 3 2 3 
  
   1 1  
2 
   10048900  10050492  10055897  10076495  10081892 
  10094801  10100692 
  10101395 
  3 1 3 3 6 
  
   2 5  
   20 
   10101495  10101595  10104692  10113592  10113697 
  10114297  10120797 
  10120897 
  1 5 4 2 6 
  
  11 1  
4 
   10121697  10121897  10121997  10133592  10142892 
  10142995  10146495 
  10150497 
 16 3 6 1 1 
  
   6 4  
4 
   10150692  10157092  10157292  10164792  10170892 
  10171795  10171895 
  10172300 
  5 2 4 4 4 
  
   4 4  
1 
   10175195  10187802  10192499  10192897  10198295 
  10200493  10201693 
  10211593 
  1 2 2 3 5 
  
   1 3  
5 
   antal1 - data.frame(antal1)
   antal1
antal1
  14379872
  1100   3
  10007995   3
  10008295   2
  10008792   3
  10010203  NA
  10018703  NA
  10033401   2
  10048900   3
  10050492   1
  10055897   3
  10076495   3
  10081892   6
  10094801   2
  10100692   5
   
  Thanks
  Rina
  
  [[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 ( http://www.r/ ) ( http://www.r/ 
 )-project.org/posting-guide.html
  and provide commented, minimal, self-contained,
  reproducible code.
  
 
 
 
   Get news delivered with the All new Yahoo!
 Mail.  Enjoy RSS feeds
 right on your Mail page. Start today at
 http://mrd.mail.yahoo.com/try_beta?.intl=ca 
 
 



  Be smarter than spam. See how smart SpamGuard is at giving junk
email the boot with the All-new Yahoo! Mail at
http://mrd.mail.yahoo.com/try_beta?.intl=ca 



[[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] Odp: Svar: Re: help with simple R-question

2007-06-06 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 06.06.2007 10:56:18:

 thanks, that works great!!
 
 just have another thing...i the same area
 What if the class is list instead of array, how can you name the first
 unrecognized column?

Hi

look in some intro manual and learn about R data structures. Matrix, 
array, vector, data.frame, list and some others have some distinct 
features and they sometimes can be interchanged and sometimes not. To 
learn how objects are organised see str(), class(), typeof(), mode().

Regards
Petr
 

 
 Rina
 
  John Kane [EMAIL PROTECTED] 06/05/07 3:17 
 
 --- Rina Miehs [EMAIL PROTECTED] wrote:
 
  hello
  
  what do i write for R to recognize both columns?
  
  In the R-script downunder you can see that i use
  tapply to get my
  information out of my data, and then i need to use
  it as a dataframe
  with both columns! It is like R is using the first
  column as an
  observationnumber or something, how can i change
  that?? 
 
 It is using the names of the variables as rownames.
 
 try 
 n.ant - names(antall)
 antal1 - data.frame(n.antal1, antal1)
 
 
  
   antal1 -tapply(l1$omlob1,l1$farid,length)
   antal1
  1437987  1100  10007995  10008295  10008792 
  10010203  10018703 
  10033401 
  2 3 3 2 3 
   1 1 
2 
   10048900  10050492  10055897  10076495  10081892 
  10094801  10100692 
  10101395 
  3 1 3 3 6 
   2 5 
   20 
   10101495  10101595  10104692  10113592  10113697 
  10114297  10120797 
  10120897 
  1 5 4 2 6 
  11 1 
4 
   10121697  10121897  10121997  10133592  10142892 
  10142995  10146495 
  10150497 
 16 3 6 1 1 
   6 4 
4 
   10150692  10157092  10157292  10164792  10170892 
  10171795  10171895 
  10172300 
  5 2 4 4 4 
   4 4 
1 
   10175195  10187802  10192499  10192897  10198295 
  10200493  10201693 
  10211593 
  1 2 2 3 5 
   1 3 
5 
   antal1 - data.frame(antal1)
   antal1
antal1
  14379872
  1100   3
  10007995   3
  10008295   2
  10008792   3
  10010203  NA
  10018703  NA
  10033401   2
  10048900   3
  10050492   1
  10055897   3
  10076495   3
  10081892   6
  10094801   2
  10100692   5
  
  Thanks
  Rina
  
  [[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 ( http://www.r/ )-project.org/posting-guide.html
  and provide commented, minimal, self-contained,
  reproducible code.
  
 
 
 
   Get news delivered with the All new Yahoo! Mail.  Enjoy RSS feeds
 right on your Mail page. Start today at
 http://mrd.mail.yahoo.com/try_beta?.intl=ca 
 
 
[[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] spgrass6 and aggregation (bis)

2007-06-06 Thread Roger Bivand
On Wed, 6 Jun 2007 [EMAIL PROTECTED] wrote:

 
 Dear all,
 
 I have some additionale question concerning the spgrass6 package.
 
 * When you set a region in GRASS, does the readGRASS6 function in R only
 load data contained in the zoomed region or the whole map ?

readRAST6() uses the current region, readVECT6() should not clip to the 
current region.

 
 * When you have a MASK map in grass, does the readGRASS6 function in R only
 load data contained inside the MASK area ?
 

MASK is respected (in spearfish):

r.mask input=rushmore
d.rast elevation.dem
R
library(spgrass6)
el - readRAST6(elevation.dem)
summary(el)
image(el)

 
 Could this be the problem ?

No, the problem was that you did not pay attention to the class of the 
data objects you were reading. You could have done:

my_SGDF - readRAST6(c(landuse_mapname_in_grass, 
  catchement_mapname_in_grass,
  precipitation_mapname_in_grass), cat=c(TRUE, TRUE, FALSE))

treating the whole as a single SpatialGridDataFrame, and the first two 
maps as factors (categorical).

Please remember that class(), summary(), image(), and other methods let 
you look at the data you have read - here I would certainly do:

summary(my_SGDF)
image(my_SGDF, precipitation_mapname_in_grass)

You can then try:

my_DF - as(my_SGDF, data.frame)
aggregate(my_DF, by=list(my_DF$catchement_mapname_in_grass, 
  my_DF$landuse_mapname_in_grass), sum, na.rm=TRUE)

although I'm not sure whether this is what you need.

There are two mailing lists that are better suited to this question, 
R-sig-geo on the R side, and STATGRASS on the GRASS side, both with a fair 
number of experienced helpers.

 
 Thanks,
 
 Jessica
 
 
 3
 
 Dear all,
 
 
 I am exporting grass map into R thanks to the very useful spgrass6 package.
 
 library(spgrass6)
 
 # I have 3 map I am working with a MASK map of a specific area.
 
 # 1) a landuse map
 landuse-readRAST6(landuse_mapname_in_grass)
 
 # 2) a catchment map which divide the area in several catchements
 catchment-readRAST6(catchement_mapname_in_grass)
 
 # 3) a precipitation map
 precipitation-readRAST6(precipitation_mapname_in_grass)
 
 
 # then I would like to sum the precipitation spatialy over each catchment
 and landuse. So, first I cbind all maps with cbind
 
 MAP-cbind(landuse,catchment,precipitation)
 
 # then I use the aggregate function
 SUM-aggregate(MAP[3],by=list(MAP[1],MAP[2]),sum,na.rm=TRUE)
 # here is the problem !!!
 Error in as.vector(x, mode) : invalid argument 'mode'
 
 
 
 I don't find any idea to solve this...
 
 Does anyone has a suggestion ??
 
 Thanks in advance
 
 
 Jess
 
 __
 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.
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

__
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] Refactor all factors in a data frame

2007-06-06 Thread Gregor Gorjanc
Hilmar Berger hilmar.berger at imise.uni-leipzig.de writes:
...
 So, is there any way in drop the unused factor levels from *all* factors 
 of a data frame without import/export ?

There is a generic drop.levels in gdata. Here is part of its help page:

\code{drop.levels} is a generic function, where default method does
nothing, while method for factor \code{s} drops all unused levels.
There are also convenient methods for \code{list} and \code{data.frame},
where all unused levels are dropped in all factors (one by one) in a
\code{list} or a \code{data.frame}.

Gregor

__
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] correspondence analysis

2007-06-06 Thread Jari Oksanen
Artem Mariupol artem.mariupol at gmail.com writes:

 
 Hello,
 
 I am new to R and I have a question about the difference between
 correspondence analysis in R and SPSS.
 This is the input table I am working with (4 products and 18 attributes):
 
  mytable
1  2  3  4  5 6  7  8  9 10 11 12 13 14 15 16 17 18
 1 15 11 20  4 14 7  1  2  1  4 12 12 17 19 11 20  9 10
 2 19 18 14 14 16 4 14 11 11 15 22 19 22 16 21 19 15 16
 3 16 13 10  9 15 4 10  7 11 13 18 17 14 14 16 16 13 11
 4 21 18 16 14 20 6 12 14 14 17 23 20 19 18 21 18 19 18
 
 I found the function corresp() in the package MASS, but the results are
 different from the output in SPSS. Also, I don't understand the coordinates;
 in the biplot I cannot find a -2 limit for example from the first product on
 any of the x axes.
 
At a quick look, there is nothing strange in the result. Have you contacted SPSS
and asked them to explain their deviant results?

It seems that biplot.correspondence is undocumented. However, it has argument
'type' which defaults to symmetric, other alternative being rows and
columns. Intelligent guess is that this selects the scaling of row and column
scores, and type=symmetric scales both. By selecting type=columns, only
columns are scaled and the -2 value for a row will be displayed (which proves
that the guess was correct).

I don't have a clue how SPSS scales results, but I guess that the differences in
the results may be due to different scalings. Function corresp gives you
weighted orthonormal row and column scores, but scales these in the plot like
specified. It may be that SPSS does the scaling already in the printout (and
does not give you the choice of type?). Another possible source of difference is
that corresp gives you canonical correlations whereas some other program or
function may give you their squares, a.k.a. eigenvalues. Moreover, the sign is
arbitrary so that negative and positive scores may be switched between 
programs. 

I hope this helps, 

Jari Oksanen

__
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] Mandriva Spring 2007 and R

2007-06-06 Thread NOEL Yvonnick
Jonathan,

If you are not willing to use the very last version of R, there is 
always a RPM package for R under Mandriva, called R-base. So that 
basically, connected as root, just type:

urpmi R-base

to install it.

HTH,

Yvonnick Noel
U. of Rennes 2

__
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] Svar: Re: help with simple R-question

2007-06-06 Thread John Kane
I think that you have the same situation as before
though I have never used ranef().  The boar ids are
acting as the row names and are not really part of the
data.frame. It just looks like that when R prints the
data.frame.  

Try 

boars - rownames(far1) 
far1 - cbind( boars, far1) 

The results may look a bit funny with two printed
columns looking the same but one will be a column in
the data.frame and the other will be the row names
column.  I hope :)

--- Rina Miehs [EMAIL PROTECTED] wrote:

  
 The left column is boar id number, and the right is
 the random effect
 estimate. I need the numbers in the left column when
 i merge far1
 together with other data.frames based on the id
 numbers. When i use
 ranef the output is the class list and R only sees
 the intercepts, but i
 need a data.frame with 'boar id' and 'niveau', two
 columns not just
 one...
  
 fx
  far1 - ranef(resultat1)[1]
  far1
 $farid
 (Intercept)
 1437987   -3.775851e-03
 1100  -3.220044e-03
 10007995   1.848914e-02
 10008295  -4.583903e-03
 10008792  -9.518371e-03
 10033401  -7.538132e-03
 10048900   1.540309e-02
  far1 - as.data.frame(far1)
  far1
X.Intercept.
 1437987   -3.775851e-03
 1100  -3.220044e-03
 10007995   1.848914e-02
 10008295  -4.583903e-03
 10008792  -9.518371e-03
 10033401  -7.538132e-03
 10048900   1.540309e-02
 Thanks again
  
 Rina
 
 
  John Kane [EMAIL PROTECTED] 06/06/07 11:38
 
 
 --- Rina Miehs [EMAIL PROTECTED] wrote:
 
  thanks, that works great!!
   
  just have another thing...i the same area
  What if the class is list instead of array, how
 can
  you name the first unrecognized column?
 
 I am not sure that I understand the question.  You
 don't really have an unrecognised column in the
 dataframe but an array of rownames ( I don't know
 how
 they are stored).
 
 I think you can do the same thing as you did for the
 data.frame but as I say, I am not sure I understand
 the question.  Would you post a little example?
 
 
   
  Rina
  
   John Kane [EMAIL PROTECTED] 06/05/07 3:17
 
  
  --- Rina Miehs [EMAIL PROTECTED] wrote:
  
   hello

   what do i write for R to recognize both columns?

   In the R-script downunder you can see that i use
   tapply to get my
   information out of my data, and then i need to
 use
   it as a dataframe
   with both columns! It is like R is using the
 first
   column as an
   observationnumber or something, how can i change
   that?? 
  
  It is using the names of the variables as
 rownames.
  
  try 
  n.ant - names(antall)
  antal1 - data.frame(n.antal1, antal1)
  
  

antal1 -tapply(l1$omlob1,l1$farid,length)
antal1
   1437987  1100  10007995  10008295  10008792 
   10010203  10018703 
   10033401 
   2 3 3 2
 3 
   
1 1  
 2 
10048900  10050492  10055897  10076495 
 10081892 
   10094801  10100692 
   10101395 
   3 1 3 3
 6 
   
2 5  
20 
10101495  10101595  10104692  10113592 
 10113697 
   10114297  10120797 
   10120897 
   1 5 4 2
 6 
   
   11 1  
 4 
10121697  10121897  10121997  10133592 
 10142892 
   10142995  10146495 
   10150497 
  16 3 6 1
 1 
   
6 4  
 4 
10150692  10157092  10157292  10164792 
 10170892 
   10171795  10171895 
   10172300 
   5 2 4 4
 4 
   
4 4  
 1 
10175195  10187802  10192499  10192897 
 10198295 
   10200493  10201693 
   10211593 
   1 2 2 3
 5 
   
1 3  
 5 
antal1 - data.frame(antal1)
antal1
 antal1
   14379872
   1100   3
   10007995   3
   10008295   2
   10008792   3
   10010203  NA
   10018703  NA
   10033401   2
   10048900   3
   10050492   1
   10055897   3
   10076495   3
   10081892   6
   10094801   2
   10100692   5

   Thanks
   Rina
   
   [[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 ( http://www.r/ ) ( http://www.r/ 
  )-project.org/posting-guide.html
   and provide commented, minimal, self-contained,
   reproducible code.
   
  
  
  
Get news delivered with the All new Yahoo!
  Mail.  Enjoy RSS feeds
  right on your Mail page. Start today at
  http://mrd.mail.yahoo.com/try_beta?.intl=ca 
  
  
 
 
 
   Be smarter than spam. See how smart SpamGuard
 is at giving junk

 http://mrd.mail.yahoo.com/try_beta?.intl=ca 
 
 
 
=== message truncated ===

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE 

[R] [R-pkgs] Package update: pmml version 1.1.1

2007-06-06 Thread Graham Williams
Version 1.1.1 of the pmml package (PMML = Predictive Modelling Markup
Language) has been uploaded to CRAN. This version adds pmml.lm to
generate PMML for linear models (currently, without interactions).

The PMML package is part of the Rattle toolkit for data
mining. Further information from http://rattle.togaware.com.

Regards,
Graham

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

__
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] [R-pkgs] New Package on Lancet Surveys of Iraq Mortality

2007-06-06 Thread David Kane
Hello,

I have placed a package on CRAN about two surveys of mortality in Iraq
that were published in the Lancet.

http://cran.at.r-project.org/src/contrib/Descriptions/lancet.iraqmortality.html

 install.packages(lancet.iraqmortality)

...

 library(lancet.iraqmortality)
Loading required package: foreign
 ?lancet.iraqmortality
 vignette(mortality)

This is a rough version. Suggestions and feedback are welcome.

Dave Kane

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

__
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] Svar: Re: help with simple R-question

2007-06-06 Thread Rina Miehs
Thanks that helped in the right way:D
Thanks alot!
Rina

 John Kane [EMAIL PROTECTED] 06/06/07 1:46 
I think that you have the same situation as before
though I have never used ranef().  The boar ids are
acting as the row names and are not really part of the
data.frame. It just looks like that when R prints the
data.frame.  

Try 

boars - rownames(far1) 
far1 - cbind( boars, far1) 

The results may look a bit funny with two printed
columns looking the same but one will be a column in
the data.frame and the other will be the row names
column.  I hope :)

--- Rina Miehs [EMAIL PROTECTED] wrote:

  
 The left column is boar id number, and the right is
 the random effect
 estimate. I need the numbers in the left column when
 i merge far1
 together with other data.frames based on the id
 numbers. When i use
 ranef the output is the class list and R only sees
 the intercepts, but i
 need a data.frame with 'boar id' and 'niveau', two
 columns not just
 one...
  
 fx
  far1 - ranef(resultat1)[1]
  far1
 $farid
 (Intercept)
 1437987   -3.775851e-03
 1100  -3.220044e-03
 10007995   1.848914e-02
 10008295  -4.583903e-03
 10008792  -9.518371e-03
 10033401  -7.538132e-03
 10048900   1.540309e-02
  far1 - as.data.frame(far1)
  far1
X.Intercept.
 1437987   -3.775851e-03
 1100  -3.220044e-03
 10007995   1.848914e-02
 10008295  -4.583903e-03
 10008792  -9.518371e-03
 10033401  -7.538132e-03
 10048900   1.540309e-02
 Thanks again
  
 Rina
 
 
  John Kane [EMAIL PROTECTED] 06/06/07 11:38
 
 
 --- Rina Miehs [EMAIL PROTECTED] wrote:
 
  thanks, that works great!!
   
  just have another thing...i the same area
  What if the class is list instead of array, how
 can
  you name the first unrecognized column?
 
 I am not sure that I understand the question.  You
 don't really have an unrecognised column in the
 dataframe but an array of rownames ( I don't know
 how
 they are stored).
 
 I think you can do the same thing as you did for the
 data.frame but as I say, I am not sure I understand
 the question.  Would you post a little example?
 
 
   
  Rina
  
   John Kane [EMAIL PROTECTED] 06/05/07 3:17
 
  
  --- Rina Miehs [EMAIL PROTECTED] wrote:
  
   hello

   what do i write for R to recognize both columns?

   In the R-script downunder you can see that i use
   tapply to get my
   information out of my data, and then i need to
 use
   it as a dataframe
   with both columns! It is like R is using the
 first
   column as an
   observationnumber or something, how can i change
   that?? 
  
  It is using the names of the variables as
 rownames.
  
  try 
  n.ant - names(antall)
  antal1 - data.frame(n.antal1, antal1)
  
  

antal1 -tapply(l1$omlob1,l1$farid,length)
antal1
   1437987  1100  10007995  10008295  10008792 
   10010203  10018703 
   10033401 
   2 3 3 2
 3 
   
1 1  
 2 
10048900  10050492  10055897  10076495 
 10081892 
   10094801  10100692 
   10101395 
   3 1 3 3
 6 
   
2 5  
20 
10101495  10101595  10104692  10113592 
 10113697 
   10114297  10120797 
   10120897 
   1 5 4 2
 6 
   
   11 1  
 4 
10121697  10121897  10121997  10133592 
 10142892 
   10142995  10146495 
   10150497 
  16 3 6 1
 1 
   
6 4  
 4 
10150692  10157092  10157292  10164792 
 10170892 
   10171795  10171895 
   10172300 
   5 2 4 4
 4 
   
4 4  
 1 
10175195  10187802  10192499  10192897 
 10198295 
   10200493  10201693 
   10211593 
   1 2 2 3
 5 
   
1 3  
 5 
antal1 - data.frame(antal1)
antal1
 antal1
   14379872
   1100   3
   10007995   3
   10008295   2
   10008792   3
   10010203  NA
   10018703  NA
   10033401   2
   10048900   3
   10050492   1
   10055897   3
   10076495   3
   10081892   6
   10094801   2
   10100692   5

   Thanks
   Rina
   
   [[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 ( http://www.r/ ) ( http://www.r/ ) ( http://www.r/

  )-project.org/posting-guide.html
   and provide commented, minimal, self-contained,
   reproducible code.
   
  
  
  
Get news delivered with the All new Yahoo!
  Mail.  Enjoy RSS feeds
  right on your Mail page. Start today at
  http://mrd.mail.yahoo.com/try_beta?.intl=ca 
  
  
 
 
 
   Be smarter than spam. See how smart SpamGuard
 is at giving junk
 email the boot with the All-new Yahoo! Mail at
 http://mrd.mail.yahoo.com/try_beta?.intl=ca 
 
 
 

[R] generating many matrices

2007-06-06 Thread Keun-Hyung Choi
I'd like to generate many matrices (let's say 100 matrices of 4x4), of which
diagonal elements are being drawn from each set of sample of known
distribution.

What would be the best way?  I've been trying to find any previous threads
for this topic, but haven't been able to find one.

 

Thanks. Kevin

 

 


[[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] R: x-y data

2007-06-06 Thread tronter

Hello

I have an Excel file with x-y data. I saved this file as a cvs file. Then I
used the read.table() function to read the data into R. If I have a formula
like (x+y)/2, how would I access x and y in R? I have the table named as
something. But how do I access the individual columns if I want to plug them
into the formula?

Thanks
-- 
View this message in context: 
http://www.nabble.com/R%3A-x-y-data-tf3874502.html#a10978448
Sent from the R help mailing list archive at Nabble.com.

__
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] R help

2007-06-06 Thread scott flemming
Hi,

I wonder whether R can finish the following project:

I want to make a chart to represent 10 genes. Each gene has orientation and 
length. Therefore, a gene can be represented by arrows. 

Can R be used to draw 10 arrows in one line ?

scott

   
-

[[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] Neural Net. in R

2007-06-06 Thread Ehsan Rasa
Hi everyone,

I'm a graduate student of engineering, lately introduced with R. and using R
for my project and thesis. I'm trying to use R for implementing a neural
network regression model and apply it to my database. I found three R
packages (AMORE , grnnR , neural) in R website, but their manuals are
not really user-friendly in my idea. I was wondering if anyone has a written
code in R using any of these packages for a feed-forward back-propagation
neural network in R that I can use it. That'll be a remedy for my nightmare
which already took quite time from me.
I would really appreciate it.

Sincerely,
Jason.

[[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] name of the variable that will contain the result of a function

2007-06-06 Thread Benilton Carvalho
Hi everyone,

say I have a function called 'foo', which takes the argument arg1.

Is there any mechanism that I can use to learn about the variable  
where foo(arg1) is going to be stored?

For example:

x - foo(arg1)

so, inside foo() I'd like to be able to get the string x.

if,

foo(arg1)

was used insted, I'd like to get NA.

thank you very much,

b






--
Benilton Carvalho
PhD Candidate
Department of Biostatistics
Bloomberg School of Public Health
Johns Hopkins University
[EMAIL PROTECTED]

__
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] sampling problem - new to R

2007-06-06 Thread baldeck

I have a data set of individual trees and the plots that they are in:

Tree  Plot
567491
634941
873751
374942
927533
348473
387474 etc...

So each plot is represented once for every individual that occurrs in it. 
Plots get different numbers of rows because there can be a different number
of individuals in each plot.

I want to make a data frame that consists of one individual from each plot. 
I would like to randomly choose one individual from each plot that is
present in the data set.  I will have to do this to multiple data sets which
may contain different plots, and may contain up to 1200 plots, so I can't
choose the plots by hand.

Please help me with this.  I'm an ecologist and I'm in Panama, with no one
around who is educated in R.  Whoever solves this problem for me will be
acknowledged in any resulting publications.

Thanks!
-Claire
-- 
View this message in context: 
http://www.nabble.com/sampling-problem---new-to-R-tf3872130.html#a10970708
Sent from the R help mailing list archive at Nabble.com.

__
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] p-value from GEE

2007-06-06 Thread carmei3
Hi to all,
I found in the R-help archive how to calculate the p-value for a gee result:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/74150.html

but there are two questions (I am afraid they are basic questions ...)
1. why is the result multiplicated  with 2
2. how could I decide between lower.tail =TRUE and FALSE:
example:
2*pnorm(c(1.8691945,0.5882351,2.4903091,1.9287802,2.3172983,2.2092593,2.2625959,1.6395695),
 
lower.tail =TRUE)  

I did not find anything about lower tail in my books only about one 
tailed and two tailed.

With regards
Carmen


Jetzt Handykosten senken mit klarmobil - 14 Ct./Min.! Hier klicken
produkte.shopping.freenet.de/handy_voip_isdn/klarmobil/index.html?pid=73025

[[alternative(swapped) 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] R help

2007-06-06 Thread Sarah Goslee
On 6/5/07, scott flemming [EMAIL PROTECTED] wrote:

 Can R be used to draw 10 arrows in one line ?

Um, sure.

Assuming you actually also want to know how to do it, why don't
you take a look at the help for arrows().

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] R help

2007-06-06 Thread michael watson \(IAH-C\)
Yes, but you need to be a bit more specific... When it comes to graphs
and drawing lines, there isn't much R can't do... 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of scott flemming
Sent: 06 June 2007 04:49
To: r-help@stat.math.ethz.ch
Subject: [R] R help

Hi,

I wonder whether R can finish the following project:

I want to make a chart to represent 10 genes. Each gene has orientation
and length. Therefore, a gene can be represented by arrows. 

Can R be used to draw 10 arrows in one line ?

scott

   
-

[[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] R: x-y data

2007-06-06 Thread jim holtman
Can you provide an example of your data.  Assuming that you have a .cvs file
and the column names are 'x' and 'y' and you have used 'read.csv', then you
would have:

(something$x + something$y) / 2



On 6/5/07, tronter [EMAIL PROTECTED] wrote:


 Hello

 I have an Excel file with x-y data. I saved this file as a cvs file. Then
 I
 used the read.table() function to read the data into R. If I have a
 formula
 like (x+y)/2, how would I access x and y in R? I have the table named as
 something. But how do I access the individual columns if I want to plug
 them
 into the formula?

 Thanks
 --
 View this message in context:
 http://www.nabble.com/R%3A-x-y-data-tf3874502.html#a10978448
 Sent from the R help mailing list archive at Nabble.com.

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

__
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] Neural Net. in R

2007-06-06 Thread Kuhn, Max
Jason,

Your best bet is the nnet package. It is part of the VR bundle, which
may be why you missed it. 

The code is well documented and the package is closely tied to two books
(see the references in ?nnet). 

Also, it has a predict function, which many of the others do not. This
isn't too big of a deal, but it certainly speaks to good design.

Max


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ehsan Rasa
Sent: Tuesday, June 05, 2007 11:45 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Neural Net. in R

Hi everyone,

I'm a graduate student of engineering, lately introduced with R. and
using R
for my project and thesis. I'm trying to use R for implementing a neural
network regression model and apply it to my database. I found three R
packages (AMORE , grnnR , neural) in R website, but their manuals
are
not really user-friendly in my idea. I was wondering if anyone has a
written
code in R using any of these packages for a feed-forward
back-propagation
neural network in R that I can use it. That'll be a remedy for my
nightmare
which already took quite time from me.
I would really appreciate it.

Sincerely,
Jason.

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

--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

__
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] generating many matrices

2007-06-06 Thread jim holtman
Is this what you want?

x - diag(4)  # 4x4 matrix
result - list()   # list to store the 100 matrices
for (i in 1:100){
diag(x) - runif(4)  # fill with random values
result[[i]] - x  # save the result
}




On 6/5/07, Keun-Hyung Choi [EMAIL PROTECTED] wrote:

 I'd like to generate many matrices (let's say 100 matrices of 4x4), of
 which
 diagonal elements are being drawn from each set of sample of known
 distribution.

 What would be the best way?  I've been trying to find any previous threads
 for this topic, but haven't been able to find one.



 Thanks. Kevin






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

__
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] sampling problem - new to R

2007-06-06 Thread jim holtman
This should create your samples:

x - Tree  Plot
567491
634941
873751
374942
927533
348473
387474 
x - read.table(textConnection(x), header=TRUE)
for(i in 1:10){  # take 10 sample
# partition data by plot
z - by(x, x$Plot, function(.plot){
.plot[sample(nrow(.plot),1),]  # choose a random sample from the
plot
})
z - do.call('rbind', z)  # create dataframe
print(z)
}




On 6/5/07, baldeck [EMAIL PROTECTED] wrote:


 I have a data set of individual trees and the plots that they are in:

 Tree  Plot
 567491
 634941
 873751
 374942
 927533
 348473
 387474 etc...

 So each plot is represented once for every individual that occurrs in it.
 Plots get different numbers of rows because there can be a different
 number
 of individuals in each plot.

 I want to make a data frame that consists of one individual from each
 plot.
 I would like to randomly choose one individual from each plot that is
 present in the data set.  I will have to do this to multiple data sets
 which
 may contain different plots, and may contain up to 1200 plots, so I can't
 choose the plots by hand.

 Please help me with this.  I'm an ecologist and I'm in Panama, with no one
 around who is educated in R.  Whoever solves this problem for me will be
 acknowledged in any resulting publications.

 Thanks!
 -Claire
 --
 View this message in context:
 http://www.nabble.com/sampling-problem---new-to-R-tf3872130.html#a10970708
 Sent from the R help mailing list archive at Nabble.com.

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

__
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] sampling problem - new to R

2007-06-06 Thread Sarah Goslee
Claire,

Here's one way to do it:

# first, generate some sample data to try
 treedata - cbind.data.frame(Tree=1:25, Plot=sample(1:5, 25, replace=TRUE))
 treedata - treedata[order(treedata$Plot),]
 treedata
   Tree Plot
1 11
2 21
6 61
9 91
11   111
17   171
18   181
23   231
13   132
16   162
25   252
5 53
10   103
4 44
7 74
8 84
24   244
3 35
12   125
14   145
15   155
19   195
20   205
21   215
22   225

# then randomly choose one tree from each plot
# getting a different random set each time
 sapply(split(treedata$Tree, treedata$Plot), sample, 1)
 1  2  3  4  5
 2 25 10  4 21
 sapply(split(treedata$Tree, treedata$Plot), sample, 1)
 1  2  3  4  5
23 13  5  4 14


Hope that solves it for you,
Sarah

On 6/5/07, baldeck [EMAIL PROTECTED] wrote:

 I have a data set of individual trees and the plots that they are in:

 Tree  Plot
 567491
 634941
 873751
 374942
 927533
 348473
 387474 etc...

 So each plot is represented once for every individual that occurrs in it.
 Plots get different numbers of rows because there can be a different number
 of individuals in each plot.

 I want to make a data frame that consists of one individual from each plot.
 I would like to randomly choose one individual from each plot that is
 present in the data set.  I will have to do this to multiple data sets which
 may contain different plots, and may contain up to 1200 plots, so I can't
 choose the plots by hand.

 Please help me with this.  I'm an ecologist and I'm in Panama, with no one
 around who is educated in R.  Whoever solves this problem for me will be
 acknowledged in any resulting publications.

 Thanks!
 -Claire
 --


-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] A question about riskmeasures() vs. qgpd() in library(evir)

2007-06-06 Thread Jacques Wagnor
Dear List,

This inquiry probably does not directly pertain to R.

I am using library(evir) to learn EVT.  Based on my reading of things,
it is my understanding that if one wants to calculate quantiles of
GPD, one could use either riskmeasures() or qgpd().  However, using
data(danish) as an example, the quantile estimates produced by
riskmeasures() are considerably different from those produced by
qgpd() as follows:

 library(evir)
 data(danish)
 out - gpd(danish, 10)
 riskmeasures(out, c(0.999, 0.))

  p  quantile sfall
[1,] 0.9990  94.28956   191.3697
[2,] 0.  304.62448 609.3696

 qgpd(c(0.999, 0.), out$par.ests[xi], out$par.ests[beta])

[1]  67.22493 200.41271

Any insights would be greatly appreciated.

Regards,

Jacques

platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  5.0
year   2007
month  04
day23
svn rev41293
language   R
version.string R version 2.5.0 (2007-04-23)

__
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] sampling problem - new to R

2007-06-06 Thread Prof Brian Ripley
On Tue, 5 Jun 2007, baldeck wrote:

 I have a data set of individual trees and the plots that they are in:

 Tree  Plot
 567491
 634941
 873751
 374942
 927533
 348473
 387474 etc...

You haven't told us what form the 'data set' is, but I will presume a data 
frame called DF.

The obvious first step is to split by Plot.  Using 'resample' from ?sample

sapply(with(DF, split(Tree, Plot)), resample, size=1)

give a vector of trees ('individuals'?) with names the plots sampled from. 
That seems to be what you want, but if not please come back to us with a 
more extensive example including the desired output.


 So each plot is represented once for every individual that occurrs in it.
 Plots get different numbers of rows because there can be a different number
 of individuals in each plot.

 I want to make a data frame that consists of one individual from each plot.
 I would like to randomly choose one individual from each plot that is
 present in the data set.  I will have to do this to multiple data sets which
 may contain different plots, and may contain up to 1200 plots, so I can't
 choose the plots by hand.

 Please help me with this.  I'm an ecologist and I'm in Panama, with no one
 around who is educated in R.  Whoever solves this problem for me will be
 acknowledged in any resulting publications.

 Thanks!
 -Claire


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Odp: sampling problem - new to R

2007-06-06 Thread Petr PIKAL
Hi

If I understand correctly, use split and sample with lapply. If DF is your 
dataframe

lapply(split(DF$Tree, DF$Plot), function(x) sample(x,1))

shall select random tree from each plot. Or you can get it in tabular form 
with sapply.

Regards
Petr

[EMAIL PROTECTED] napsal dne 05.06.2007 16:29:49:

 
 I have a data set of individual trees and the plots that they are in:
 
 Tree  Plot
 567491
 634941
 873751
 374942
 927533
 348473
 387474 etc...
 
 So each plot is represented once for every individual that occurrs in 
it. 
 Plots get different numbers of rows because there can be a different 
number
 of individuals in each plot.
 
 I want to make a data frame that consists of one individual from each 
plot. 
 I would like to randomly choose one individual from each plot that is
 present in the data set.  I will have to do this to multiple data sets 
which
 may contain different plots, and may contain up to 1200 plots, so I 
can't
 choose the plots by hand.
 
 Please help me with this.  I'm an ecologist and I'm in Panama, with no 
one
 around who is educated in R.  Whoever solves this problem for me will be
 acknowledged in any resulting publications.
 
 Thanks!
 -Claire
 -- 
 View this message in context: 
http://www.nabble.com/sampling-problem---new-to-
 R-tf3872130.html#a10970708
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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] generating many matrices

2007-06-06 Thread hadley wickham
On 6/6/07, Keun-Hyung Choi [EMAIL PROTECTED] wrote:
 I'd like to generate many matrices (let's say 100 matrices of 4x4), of which
 diagonal elements are being drawn from each set of sample of known
 distribution.

 What would be the best way?  I've been trying to find any previous threads
 for this topic, but haven't been able to find one.

One approach would be:

replicate(100, diag(runif(4)), simplify=FALSE)

Hadley

__
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] sampling problem - new to R

2007-06-06 Thread Doran, Harold
I dealt with something like this recently. 

x - data.frame(plot = gl(2,5), tree = rnorm(10)) 
y - split(x, x$plot)

ss - numeric(2)
for(i in 1:2){
ss[i] - sample(row.names(y[[i]][1]), 1)
}

z - x[ss,]

People help out of the goodness of the hearts and not for publication
recognition. 

Harold


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of baldeck
 Sent: Tuesday, June 05, 2007 10:30 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] sampling problem - new to R
 
 
 I have a data set of individual trees and the plots that they are in:
 
 Tree  Plot
 567491
 634941
 873751
 374942
 927533
 348473
 387474 etc...
 
 So each plot is represented once for every individual that 
 occurrs in it. 
 Plots get different numbers of rows because there can be a 
 different number of individuals in each plot.
 
 I want to make a data frame that consists of one individual 
 from each plot. 
 I would like to randomly choose one individual from each plot 
 that is present in the data set.  I will have to do this to 
 multiple data sets which may contain different plots, and may 
 contain up to 1200 plots, so I can't choose the plots by hand.
 
 Please help me with this.  I'm an ecologist and I'm in 
 Panama, with no one around who is educated in R.  Whoever 
 solves this problem for me will be acknowledged in any 
 resulting publications.
 
 Thanks!
 -Claire
 --
 View this message in context: 
 http://www.nabble.com/sampling-problem---new-to-R-tf3872130.ht
 ml#a10970708
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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.


[R] Sargan Test and Hansen J Statistc for Simultaneous Equation Model

2007-06-06 Thread David STADELMANN
Dear R Users,

I am estimation a Simultaneous Equation Model with systemfit.

Does anyone of you know how to do a Sargan Test for overidentifiaction 
and a Hansen J statistic for instrument adequacy. Is there a possibility 
in R to do a Hausman-Wu test for the exogeneity of specific variables?

Do you know any other possibilities in R to perform similar tests 
(overidentification, instrument adequacy and exogeneity)?

Thank you very much for your help.
Yours
David

-- 
##
David Stadelmann
Lehrstuhl für Makroökonomie,
Internationale Industrie- und Wachstumspolitik
Université de Fribourg
Bureau F410
Bd de Pérolles 90
CH-1700 Fribourg
SCHWEIZ

Tel: +41 (026) 300 93 82
Fax: +41 (026) 300 96 78
Mob (priv): +41 (076) 542 33 48
Email: [EMAIL PROTECTED]
Internet: http://www.unifr.ch/natoek
Internet (priv): http://david.stadelmann-online.com

__
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] Odp: Odp: sampling problem - new to R

2007-06-06 Thread Petr PIKAL
 Hi
 
 If I understand correctly, use split and sample with lapply. If DF is 
your dataframe
 
 lapply(split(DF$Tree, DF$Plot), function(x) sample(x,1))
 
 shall select random tree from each plot. Or you can get it in tabular 
form with sapply.
 
 Regards
 Petr

Sorry, you shall use resample from sample help page as Prof.Ripley pointed 
if you can have length=1 plot.

Regards
Petr


 
 [EMAIL PROTECTED] napsal dne 05.06.2007 16:29:49:
 
  
  I have a data set of individual trees and the plots that they are in:
  
  Tree  Plot
  567491
  634941
  873751
  374942
  927533
  348473
  387474 etc...
  
  So each plot is represented once for every individual that occurrs in 
it. 
  Plots get different numbers of rows because there can be a different 
number
  of individuals in each plot.
  
  I want to make a data frame that consists of one individual from each 
plot. 
  I would like to randomly choose one individual from each plot that is
  present in the data set.  I will have to do this to multiple data sets 
which
  may contain different plots, and may contain up to 1200 plots, so I 
can't
  choose the plots by hand.
  
  Please help me with this.  I'm an ecologist and I'm in Panama, with no 
one
  around who is educated in R.  Whoever solves this problem for me will 
be
  acknowledged in any resulting publications.
  
  Thanks!
  -Claire
  -- 
  View this message in context: 
http://www.nabble.com/sampling-problem---new-to-
  R-tf3872130.html#a10970708
  Sent from the R help mailing list archive at Nabble.com.
  
  __
  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] the biggest integer R can display in complete form but not scientific form

2007-06-06 Thread Rob Creecy
You could try the gmp multi precision arithmetic package.

  library(gmp)
  urand.bigz(10,64)
 [1] 11691875040763095143 15618480061048441861 
13311871202921807091 419603425985430936 
 [5] 1009212057431928522  7087885826104674385  
12844267011818015745 12455584250595618327
 [9] 13509505397081611804 17712034795004058021

Rob

Francisco J. Zagmutt wrote:
 Also, look at options(digits) to set the number digits to be printed in 
 the console, i.e.

   pi
 [1] 3.141593

   options(digits=22)
   pi
 [1] 3.141592653589793
   

 Regards

 Francisco


 Roland Rau wrote:
   
 李俊杰 wrote:
 
 Dear R-lister,

 One of my friends wanted to produce random number which is 64 bits. He did
 it with Fortune. I think R can do it also. But I don't know how to display a
 very big integer in the complete form but not scientific form. And what's
 the biggest integer R can display in complete form ?

 Thanks in advance,

 Li Junjie



   
 I guess the biggest integer R can represent (if this is what you mean) 
 is machine dependent and you can find it out via:

 .Machine
 help(.Machine)

 I hope this helps,
 Roland

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




__
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] anova(lme)

2007-06-06 Thread Johannes Mühe
I'd like to do 2 ANOVA with repeated measurement.

 

First:response = AS

1.within-factor = modal

2.within-factor = ref

(all stairs of the factors are repeated measured) so that

random = vp

I did it like this: (anova(lme(AS~modal*ref,random=~1|vp)))

Is it correct?

 

Second: response = AS

 between-factor = sehsinn

 within-factor = ref

 (all stairs of the within factor are repeated measured) so that

 random = vpT

I did it like this: (anova(lme(AS~sehsinn*ref,random=~1|vpT)))

Is it correct?

 

In the help for R is written that p-values are calculated by Wald tests.

How does R for this calculate the denominator degrees of freedom?
(they are looking very strange)

 

Thanks

 

 

[[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] sampling problem - new to R

2007-06-06 Thread Gabor Grothendieck
A variation of Brian's idea of using resample in ?sample would be:

   set.seed(1) # makes sample reproducible
   aggregate(DF[1], DF[2], resample, size = 1)

Using resample ensures that the solution works even if some
of the Plots only have one Tree.  Some of the solutions
that were presented in this thread do not work properly in that case
as sample acts differently according to whether its first argument's
length is 1 or  1.

On 6/6/07, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Tue, 5 Jun 2007, baldeck wrote:

  I have a data set of individual trees and the plots that they are in:
 
  Tree  Plot
  567491
  634941
  873751
  374942
  927533
  348473
  387474 etc...

 You haven't told us what form the 'data set' is, but I will presume a data
 frame called DF.

 The obvious first step is to split by Plot.  Using 'resample' from ?sample

 sapply(with(DF, split(Tree, Plot)), resample, size=1)

 give a vector of trees ('individuals'?) with names the plots sampled from.
 That seems to be what you want, but if not please come back to us with a
 more extensive example including the desired output.


  So each plot is represented once for every individual that occurrs in it.
  Plots get different numbers of rows because there can be a different number
  of individuals in each plot.
 
  I want to make a data frame that consists of one individual from each plot.
  I would like to randomly choose one individual from each plot that is
  present in the data set.  I will have to do this to multiple data sets which
  may contain different plots, and may contain up to 1200 plots, so I can't
  choose the plots by hand.
 
  Please help me with this.  I'm an ecologist and I'm in Panama, with no one
  around who is educated in R.  Whoever solves this problem for me will be
  acknowledged in any resulting publications.
 
  Thanks!
  -Claire
 

 --
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595

 __
 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] name of the variable that will contain the result of a function

2007-06-06 Thread Thomas Lumley
On Wed, 6 Jun 2007, Benilton Carvalho wrote:

 Hi everyone,

 say I have a function called 'foo', which takes the argument arg1.

 Is there any mechanism that I can use to learn about the variable
 where foo(arg1) is going to be stored?

No. This information isn't available explicitly even at the C level.

 For example:

 x - foo(arg1)

 so, inside foo() I'd like to be able to get the string x.

 if,

 foo(arg1)

 was used insted, I'd like to get NA.

It could be much worse that this, for example,
x[[7]][y][[4]] - foo(arg1)
w - foo(arg2)+1
names(x)[foo(arg3)] - foo(arg4)

-thomas

__
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] random numbers selection - simple example

2007-06-06 Thread Jenny Barnes
Dear R-help,

Which random number generator function would you recommend for simply picking 
15 
random numbers from the sequence 0-42? I want to use replacement (so that the 
same number could potentially be picked more than once).

I have read the R-help archives and the statistics and computing book on modern 
Applied statistics with S but the advice seems to be for much form complicated 
examples, there must be a simpler way for what I am trying to do?

If anybody can help me I would greatly appreciate your advice and time,

Best Wishes,

Jenny


~~
Jennifer Barnes
PhD student: long range drought prediction 
Climate Extremes Group
Department of Space and Climate Physics
University College London
Holmbury St Mary 
Dorking, Surrey, RH5 6NT
Web: http://climate.mssl.ucl.ac.uk

__
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] R: x-y data

2007-06-06 Thread john seers \(IFR\)


 
tt-read.table(C:/temp/test.csv, header=T, sep=,)

# Try:

tt$x
tt$y

# OR

tt[x]
tt[y]

# OR

tt[[x]]
tt[[y]]

# OR

tt[1]
tt[2] 
tt[[1]]
tt[[2]]

# Is this what you want?



I have an Excel file with x-y data. I saved this file as a cvs file.
Then I
used the read.table() function to read the data into R. If I have a
formula
like (x+y)/2, how would I access x and y in R? I have the table named
as
something. But how do I access the individual columns if I want to plug
them
into the formula?

__
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] Chow Test

2007-06-06 Thread Bernd Stampfl

Hello R-users!
I tried to find a package to run a CHOW TEST. As a reference package I found
the STRUCCHANGE package. Do you know if it works well otherwise can you
recommend a different one?

Thanks, Bernd
-- 
View this message in context: 
http://www.nabble.com/Chow-Test-tf3878416.html#a10990270
Sent from the R help mailing list archive at Nabble.com.

__
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] the biggest integer R can display in complete form but not scientific form

2007-06-06 Thread 李俊杰
Yeah, this is absolutely what I want!

Thanks all above for your helpful suggestion.


2007/6/6, Rob Creecy [EMAIL PROTECTED]:

 You could try the gmp multi precision arithmetic package.

  library(gmp)
  urand.bigz(10,64)
 [1] 11691875040763095143 15618480061048441861
 13311871202921807091 419603425985430936
 [5] 1009212057431928522  7087885826104674385
 12844267011818015745 12455584250595618327
 [9] 13509505397081611804 17712034795004058021

 Rob

 Francisco J. Zagmutt wrote:
  Also, look at options(digits) to set the number digits to be printed in
  the console, i.e.
 
pi
  [1] 3.141593
 
options(digits=22)
pi
  [1] 3.141592653589793
 
 
  Regards
 
  Francisco
 
 
  Roland Rau wrote:
 
  Àî¿¡½Ü wrote:
 
  Dear R-lister,
 
  One of my friends wanted to produce random number which is 64 bits. He
 did
  it with Fortune. I think R can do it also. But I don't know how to
 display a
  very big integer in the complete form but not scientific form. And
 what's
  the biggest integer R can display in complete form ?
 
  Thanks in advance,
 
  Li Junjie
 
 
 
 
  I guess the biggest integer R can represent (if this is what you mean)
  is machine dependent and you can find it out via:
 
  .Machine
  help(.Machine)
 
  I hope this helps,
  Roland
 
  __
  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.
 
 
 

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




-- 
Junjie Li,  [EMAIL PROTECTED]
Undergranduate in DEP of Tsinghua University,

[[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] Linear Discriminant Analysis

2007-06-06 Thread Soare Marcian-Alin
Hello,

I want to make a linear discriminant analysis for the dataset olive, and I
get always this error:#
Warning message:
variables are collinear in: lda.default(x, grouping, ...)

## Loading Data
library(MASS)
olive - url(
http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R;)
print(load(olive))

y - 1:572
x - sample(y)
y1 - x[1:286]

train - olive[y1,-11]
test  - olive[-y1,-11]

summary(train)
summary(test)

table(train$Region)
table(test$Region)

# Linear Discriminant Analysis
z - lda(Region ~ . , train)
predict(z, train)

z - lda(Region ~ . , test)
predict(z, test)

Thanks in advance!

-- 
Mit freundlichen Grüssen / Best Regards

Soare Marcian-Alin

[[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] Neural Net. in R

2007-06-06 Thread Wensui Liu
Hi, there,
I am surprised you didn't mention nnet package.
You can find very good information in Dr Ripley's MASS book about the
usage of nnet package.

On 6/5/07, Ehsan Rasa [EMAIL PROTECTED] wrote:
 Hi everyone,

 I'm a graduate student of engineering, lately introduced with R. and using R
 for my project and thesis. I'm trying to use R for implementing a neural
 network regression model and apply it to my database. I found three R
 packages (AMORE , grnnR , neural) in R website, but their manuals are
 not really user-friendly in my idea. I was wondering if anyone has a written
 code in R using any of these packages for a feed-forward back-propagation
 neural network in R that I can use it. That'll be a remedy for my nightmare
 which already took quite time from me.
 I would really appreciate it.

 Sincerely,
 Jason.

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



-- 
WenSui Liu
A lousy statistician who happens to know a little programming
(http://spaces.msn.com/statcompute/blog)

__
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] random numbers selection - simple example

2007-06-06 Thread Jenny Barnes
You're all stars - thanks for the replies - I will go ahead and use 
sample...
I need to do this about 10,000 times - any suggestions for this or simply put 
it 
in a loop 10,000 times outputting each time to an array?

Best Wishes,

Jenny 




  use sample(c(0:42), 15, replace=T)

hope it helps,
kevin

- Original Message -
From: Jenny Barnes [EMAIL PROTECTED]
Date: Wednesday, June 6, 2007 10:30 am
Subject: [R] random numbers selection - simple example

 Dear R-help,
 
 Which random number generator function would you recommend for 
 simply picking 15 
 random numbers from the sequence 0-42? I want to use replacement 
 (so that the 
 same number could potentially be picked more than once).
 
 I have read the R-help archives and the statistics and computing 
 book on modern 
 Applied statistics with S but the advice seems to be for much form 
 complicated 
 examples, there must be a simpler way for what I am trying to do?
 
 If anybody can help me I would greatly appreciate your advice and 
 time,
 Best Wishes,
 
 Jenny
 
 
 ~~
 Jennifer Barnes
 PhD student: long range drought prediction 
 Climate Extremes Group
 Department of Space and Climate Physics
 University College London
 Holmbury St Mary 
 Dorking, Surrey, RH5 6NT
 Web: http://climate.mssl.ucl.ac.uk
 
 __
 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.htmland provide commented, minimal, self-contained, 
 reproducible code.
 

~~
Jennifer Barnes
PhD student: long range drought prediction 
Climate Extremes Group
Department of Space and Climate Physics
University College London
Holmbury St Mary 
Dorking, Surrey, RH5 6NT
Tel: 01483 204149
Mob: 07916 139187
Web: http://climate.mssl.ucl.ac.uk

__
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] random numbers selection - simple example

2007-06-06 Thread Sarah Goslee
Assuming you want only integers, see
?sample

Sarah

On 6/6/07, Jenny Barnes [EMAIL PROTECTED] wrote:
 Dear R-help,

 Which random number generator function would you recommend for simply picking 
 15
 random numbers from the sequence 0-42? I want to use replacement (so that the
 same number could potentially be picked more than once).

 I have read the R-help archives and the statistics and computing book on 
 modern
 Applied statistics with S but the advice seems to be for much form complicated
 examples, there must be a simpler way for what I am trying to do?

 If anybody can help me I would greatly appreciate your advice and time,

 Best Wishes,

 Jenny




-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] R: x-y data

2007-06-06 Thread John Kane
There are a couple of ways but I think you need to
read  about R . Have a look at Managing data
http://cran.r-project.org/doc/contrib/Lemon-kickstart/index.html

and / or read the Intro to R manual available on CRAN
or probably from the R help icon. 

you have a data.frame DF you can assign names to the
variables 

?names
names(DF) - c(x, y) and attach the data.frame

?attach

or you can reference the columns

as DF[,1] and DF[,2]



--- tronter [EMAIL PROTECTED] wrote:

 
 Hello
 
 I have an Excel file with x-y data. I saved this
 file as a cvs file. Then I
 used the read.table() function to read the data into
 R. If I have a formula
 like (x+y)/2, how would I access x and y in R? I
 have the table named as
 something. But how do I access the individual
 columns if I want to plug them
 into the formula?
 
 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] Courses: Traditional and Modern Approaches to Statistical Modelling with R by Dr Bill Venables. in Raleigh and Washington DC

2007-06-06 Thread Sue Turner

__
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] Chow Test

2007-06-06 Thread Achim Zeileis
On Wed, 6 Jun 2007, Bernd Stampfl wrote:


 Hello R-users!
 I tried to find a package to run a CHOW TEST. As a reference package I found
 the STRUCCHANGE package. Do you know if it works well

If you have concerns regarding the reliability, you can check the
underlying source code and read the accompanying publications (which also
comment on reliability and reproducibility).

 otherwise can you recommend a different one?

If the breakpoint is known, you can easily compute the Chow test by hand:
set up a factor that codes the two regimes and then fit the un-segmented
and segmented regressions:
  fac - my_time  my_break
  fm0 - lm(y ~ x1 + x2 ...)
  fm1 - lm(y ~ fac / (x1 + x2 ...))
  anova(fm0, fm1)
If you want other covariances in the test, you can also use waldtest()
from the lmtest package.

If the breakpoint is not known in advance, a supF test (aka supChow) over
all conceivable breakpoints is more appropriate. This is also provided in
strucchange along with a rich set of other testing (and dating)
techniques.

Best,
Z

 Thanks, Bernd
 --
 View this message in context: 
 http://www.nabble.com/Chow-Test-tf3878416.html#a10990270
 Sent from the R help mailing list archive at Nabble.com.

 __
 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] R: x-y data

2007-06-06 Thread Jeff Newmiller
Or read ?attach

   attach(something)
   (x+y)/2
   detach(something)

jim holtman wrote:
 Can you provide an example of your data.  Assuming that you have a .cvs file
 and the column names are 'x' and 'y' and you have used 'read.csv', then you
 would have:
 
 (something$x + something$y) / 2
 
 
 
 On 6/5/07, tronter [EMAIL PROTECTED] wrote:

 Hello

 I have an Excel file with x-y data. I saved this file as a cvs file. Then
 I
 used the read.table() function to read the data into R. If I have a
 formula
 like (x+y)/2, how would I access x and y in R? I have the table named as
 something. But how do I access the individual columns if I want to plug
 them
 into the formula?

-- 
---
Jeff NewmillerThe .   .  Go Live...
DCN:[EMAIL PROTECTED]Basics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
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] random numbers selection - simple example

2007-06-06 Thread Ted Harding
On 06-Jun-07 14:30:44, Jenny Barnes wrote:
 Dear R-help,
 
 Which random number generator function would you recommend for
 simply picking 15 random numbers from the sequence 0-42? I want
 to use replacement (so that the same number could potentially be
 picked more than once).

R has the function sample() which samples a given number of items
from a given set, without replacement by default, but with replacement
if you specify this. Enter

  ?sample

for more information. In the above case

  sample((0:42), 15, replace=TRUE)

will do what you seem to describe above. Example:

 sample((0:42), 15, replace=TRUE)
 [1] 26 38  1 41 11 30 22 37 28  0  0 25 10 39 27

if you want them in random order (i.e. as they come off the line),
or

 sort(sample((0:42), 15, replace=TRUE))
 [1]  1  3  5  8  8 10 16 17 21 25 30 30 33 34 40

if you want them sorted.

Best wishes,
Ted.

 I have read the R-help archives and the statistics and computing
 book on modern Applied statistics with S but the advice seems to
 be for much form complicated examples, there must be a simpler way
 for what I am trying to do?
 
 If anybody can help me I would greatly appreciate your advice and time,
 
 Best Wishes,
 
 Jenny


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 06-Jun-07   Time: 16:24:15
-- XFMail --

__
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] random numbers selection - simple example

2007-06-06 Thread Daniel Nordlund
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Jenny Barnes
 Sent: Wednesday, June 06, 2007 7:55 AM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] random numbers selection - simple example
 
 You're all stars - thanks for the replies - I will go ahead and use
 sample...
 I need to do this about 10,000 times - any suggestions for this or simply put 
 it
 in a loop 10,000 times outputting each time to an array?
 
 Best Wishes,
 
 Jenny
 
 
 
 
   use sample(c(0:42), 15, replace=T)
 
 hope it helps,
 kevin

You could try something like the following

s-matrix(sample(c(0:42), 1*15, replace=TRUE), 1, 15)

which will give you a 1 row matrix with 1 sample of size 15 per row.

Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA USA

__
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] Linear Discriminant Analysis

2007-06-06 Thread Soare Marcian-Alin
Thanks for explaining...

Im just sitting at the homework for 6 hours after taking for one week
antibiotica, because i had an amygdalitis...
I just wanted some tipps for solving this homework, but thanks, I will try
to get help on another way :)

I think i solved it, but I still get this Error :(

## Loading Data
library(MASS)
olive - url(
http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R;)
print(load(olive))
dim(olive)
summary(olive)

index - sample(nrow(olive), 286)

train  - olive[index,-11]
test   - olive[-index,-11]

summary(train)
summary(test)

table(train$Region)
table(test$Region)

# Linear Discriminant Analysis
z - lda(Region ~ . , train)
zn - predict(z, newdata=test)$class
mean(zn != test$Region)

2007/6/6, Uwe Ligges [EMAIL PROTECTED]:


 So what about asking your teacher (who seems to be Peter Filzmoser) and
 try to find out your homework yourself?
 You might want to think about some assumptions that must hold for LDA
 and look at the class of your explaining variables ...

 Uwe Ligges



 Soare Marcian-Alin wrote:
  Hello,
 
  I want to make a linear discriminant analysis for the dataset olive, and
 I
  get always this error:#
  Warning message:
  variables are collinear in: lda.default(x, grouping, ...)
 
  ## Loading Data
  library(MASS)
  olive - url(
 
 http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R
 )
  print(load(olive))
 
  y - 1:572
  x - sample(y)
  y1 - x[1:286]
 
  train - olive[y1,-11]
  test  - olive[-y1,-11]
 
  summary(train)
  summary(test)
 
  table(train$Region)
  table(test$Region)
 
  # Linear Discriminant Analysis
  z - lda(Region ~ . , train)
  predict(z, train)
 
  z - lda(Region ~ . , test)
  predict(z, test)
 
  Thanks in advance!
 
 
 
  
 
  __
  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.




-- 
Mit freundlichen Grüssen / Best Regards

Soare Marcian-Alin

[[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] Linear Discriminant Analysis

2007-06-06 Thread Uwe Ligges

So what about asking your teacher (who seems to be Peter Filzmoser) and 
try to find out your homework yourself?
You might want to think about some assumptions that must hold for LDA 
and look at the class of your explaining variables ...

Uwe Ligges



Soare Marcian-Alin wrote:
 Hello,
 
 I want to make a linear discriminant analysis for the dataset olive, and I
 get always this error:#
 Warning message:
 variables are collinear in: lda.default(x, grouping, ...)
 
 ## Loading Data
 library(MASS)
 olive - url(
 http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R;)
 print(load(olive))
 
 y - 1:572
 x - sample(y)
 y1 - x[1:286]
 
 train - olive[y1,-11]
 test  - olive[-y1,-11]
 
 summary(train)
 summary(test)
 
 table(train$Region)
 table(test$Region)
 
 # Linear Discriminant Analysis
 z - lda(Region ~ . , train)
 predict(z, train)
 
 z - lda(Region ~ . , test)
 predict(z, test)
 
 Thanks in advance!
 
 
 
 
 
 __
 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.


[R] Using odesolve to produce non-negative solutions

2007-06-06 Thread Jeremy Goldhaber-Fiebert
Hello,

I am using odesolve to simulate a group of people moving through time and 
transmitting infections to one another. 

In Matlab, there is a NonNegative option which tells the Matlab solver to keep 
the vector elements of the ODE solution non-negative at all times. What is the 
right way to do this in R?

Thanks,
Jeremy

P.S., Below is a simplified version of the code I use to try to do this, but I 
am not sure that it is theoretically right 

dynmodel - function(t,y,p) 
{ 
## Initialize parameter values

birth - p$mybirth(t)
death - p$mydeath(t)
recover - p$myrecover
beta - p$mybeta
vaxeff - p$myvaxeff
vaccinated - p$myvax(t)

vax - vaxeff*vaccinated/100

## If the state currently has negative quantities (shouldn't have), then reset 
to reasonable values for computing meaningful derivatives

for (i in 1:length(y)) {
if (y[i]0) {
y[i] - 0
}
}

S - y[1]
I - y[2]
R - y[3]
N - y[4]

shat - (birth*(1-vax)) - (death*S) - (beta*S*I/N)
ihat - (beta*S*I/N) - (death*I) - (recover*I)
rhat - (birth*(vax)) + (recover*I) - (death*R)

## Do we overshoot into negative space, if so shrink derivative to bring state 
to 0 
## then rescale the components that take the derivative negative

if (shat+S0) {
shat_old - shat
shat - -1*S
scaled_transmission - (shat/shat_old)*(beta*S*I/N)
ihat - scaled_transmission - (death*I) - (recover*I)

}   
if (ihat+I0) {
ihat_old - ihat
ihat - -1*I
scaled_recovery - (ihat/ihat_old)*(recover*I)
rhat - scaled_recovery +(birth*(vax)) - (death*R)

}   
if (rhat+R0) {
rhat - -1*R
}   

nhat - shat + ihat + rhat

if (nhat+N0) {
nhat - -1*N
}   

## return derivatives

list(c(shat,ihat,rhat,nhat),c(0))

}

__
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] Neural Net. in R

2007-06-06 Thread Vladimir Eremeev

I have written some bindings from the SNNS (Stuttgart Neural Network
Simulator) to R.
However, this work is not finished since the lack of interest to it and lack
of time.
At the moment, I use the mixture of scripts for R, cmd.exe, bash, and SNNS'
batchman (latter two under cygwin) in my work.

SNNS by itself is rather feature rich and well documented.
Unfortunately its development has stopped many years ago, and it contains
bugs, which I still failed to find and eliminate.


Ehsan Rasa wrote:
 
 Hi everyone,
 
 I'm a graduate student of engineering, lately introduced with R. and using
 R
 for my project and thesis. I'm trying to use R for implementing a neural
 network regression model and apply it to my database. I found three R
 packages (AMORE , grnnR , neural) in R website, but their manuals
 are
 not really user-friendly in my idea. I was wondering if anyone has a
 written
 code in R using any of these packages for a feed-forward back-propagation
 neural network in R that I can use it. That'll be a remedy for my
 nightmare
 which already took quite time from me.
 I would really appreciate it.
 
 Sincerely,
 Jason.
 

-- 
View this message in context: 
http://www.nabble.com/Neural-Net.-in-R-tf3877741.html#a10991934
Sent from the R help mailing list archive at Nabble.com.

__
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] how to update R version

2007-06-06 Thread Yanqin Yang
Hello,
   
  I am new in using Linux R. Would someone tell me what the best way to update 
my current R 2.3.0 to R 2.5.0? I want to keep my current library packages. Do I 
have to erase the older version and install the newer version? In that case, I 
need to re-download all the packages I need. Any short way to do the update?
   
  Thanks for your help!
   
  yanqin

   
-

[[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] Meaning of locfit warnings procv: parameters out of bounds?

2007-06-06 Thread Barnet Wagman
I'm getting the following warning from locfit:

Warning: procv: parameters out of bounds

Does anyone know what this means? (I haven't found anything about it in 
the locfit documentation or the list's archives).

thanks,

Barnet Wagman

__
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] Fwd: Using odesolve to produce non-negative solutions

2007-06-06 Thread Jeremy Goldhaber-Fiebert
Hello,

I am using odesolve to simulate a group of people moving through time and 
transmitting infections to one another. 

In Matlab, there is a NonNegative option which tells the Matlab solver to keep 
the vector elements of the ODE solution non-negative at all times. What is the 
right way to do this in R?

Thanks,
Jeremy

P.S., Below is a simplified version of the code I use to try to do this, but I 
am not sure that it is theoretically right 

dynmodel - function(t,y,p) 
{ 
## Initialize parameter values

birth - p$mybirth(t)
death - p$mydeath(t)
recover - p$myrecover
beta - p$mybeta
vaxeff - p$myvaxeff
vaccinated - p$myvax(t)

vax - vaxeff*vaccinated/100

## If the state currently has negative quantities (shouldn't have), then reset 
to reasonable values for computing meaningful derivatives

for (i in 1:length(y)) {
if (y[i]0) {
y[i] - 0
}
}

S - y[1]
I - y[2]
R - y[3]
N - y[4]

shat - (birth*(1-vax)) - (death*S) - (beta*S*I/N)
ihat - (beta*S*I/N) - (death*I) - (recover*I)
rhat - (birth*(vax)) + (recover*I) - (death*R)

## Do we overshoot into negative space, if so shrink derivative to bring state 
to 0 
## then rescale the components that take the derivative negative

if (shat+S0) {
shat_old - shat
shat - -1*S
scaled_transmission - (shat/shat_old)*(beta*S*I/N)
ihat - scaled_transmission - (death*I) - (recover*I)

}   
if (ihat+I0) {
ihat_old - ihat
ihat - -1*I
scaled_recovery - (ihat/ihat_old)*(recover*I)
rhat - scaled_recovery +(birth*(vax)) - (death*R)

}   
if (rhat+R0) {
rhat - -1*R
}   

nhat - shat + ihat + rhat

if (nhat+N0) {
nhat - -1*N
}   

## return derivatives

list(c(shat,ihat,rhat,nhat),c(0))

}

__
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] Question on RandomForest in unsupervised mode

2007-06-06 Thread Irilenia Nobeli
Hi,

I attempted to run the randomForest() function on a dataset without  
predefined classes. According to the manual, running randomForest  
without a response variable/class labels should result in the  
function assuming you are running in unsupervised mode. In this case,  
I understand that my data is all assigned to one class whereas a  
second synthetic class is made up, which is assigned to a second  
class. The online manual suggests that an oob misclassification error  
in this two-class problem of ~40% or more would indicate that the x- 
variables look like independent variables to random forests (and I  
assume that in this case the proximities obtained by the randomForest  
would not be informative for clustering).

When I run randomForest() in the unsupervised mode my first problem  
is that I get NULL entries for the confusion matrix and the err.rate,  
but I suppose this is normal behaviour. My only information (apart  
from the proximities of course), seems to be the votes, from which I  
can deduce whether the variables are meaningful or not. The second  
problem is that, in my case, all my observations seem to have about  
20-40% of the votes from class 1 and the rest from class 2 (i.e.  
class 2 wins always). Assuming that class 1 was assigned to my  
original data, I'd say this is rather surprising.
Initially I thought this was simply a problem of my data not being  
meaningful, but I repeated simply the forest with the iris example  
data and I get more or less the same result.
I did simply:

iris.urf - randomForest(iris[,-5])
iris.urf$votes

and I got again most of the votes coming from class 2, although here  
vote percentages are slightly more balanced than with my data  
(approximately 40 to 60% most of the time).

Has anyone got experience with unsupervised randomForest() in R and  
can explain to me why I'm observing this behaviour? In general, any  
hints about pitfalls regarding random forests in unsupervised mode  
would be very much appreciated.

Many thanks in advance,

Irilenia

-
Irilenia (Irene) Nobeli
Randall Division of Cell and Molecular Biophysics
New Hunt's House (room 3.14)
King's College London, Guy's Campus
London, SE1 1UL
U.K.
[EMAIL PROTECTED]
+44(0)207-8486329

__
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] Question: RMySQL bulk load/update one column, dbWriteTable()?

2007-06-06 Thread Waverley
Hi,

I have a question reading using RMySQL trying to load one R vector into a
table column.  To be more specifically, the table is there populated.  Now I
add a new column and want to populate this.

Can some colleagues on this list teach me how to do this?  I know how to
write one R object/table into MYSQL table using dbWriteTable.  But in this
situation, I just want to do one column.

Thanks much in advance.


-- 
Waverley

[[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] R help

2007-06-06 Thread John Kane

--- scott flemming [EMAIL PROTECTED] wrote:

 Hi,
 
 I wonder whether R can finish the following project:
 
 I want to make a chart to represent 10 genes. Each
 gene has orientation and length. Therefore, a gene
 can be represented by arrows. 
 
 Can R be used to draw 10 arrows in one line ?
 
 scott

Do you mean something like this?

x - 1:10
y - 1:10
plot(x,y, type=n )
arrows(c(1,4,6),c(3,3,3), c(2,3, 7), c(4,4,2))

__
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] how to update R version

2007-06-06 Thread Kevin E. Thorpe
Yanqin Yang wrote:
 Hello,
 
 I am new in using Linux R. Would someone tell me what the best way to
 update my current R 2.3.0 to R 2.5.0? I want to keep my current
 library packages. Do I have to erase the older version and install
 the newer version? In that case, I need to re-download all the
 packages I need. Any short way to do the update?
 
 Thanks for your help!
 
 yanqin
 

Since I compile from source, I simply compile the new version and
install it to the same location as the old.  Then I run
update.packages() to update the additional packages I have
installed. Of course, I may get bit by this approach one day.

It is possible to have more than one directory for packages.
One suggestion I've seen is to collect your user installed
packages in a different directory than the base and recommended
packages.

-- 
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Department of Public Health Sciences
Faculty of Medicine, University of Toronto
email: [EMAIL PROTECTED]  Tel: 416.864.5776  Fax: 416.864.6057

__
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] Removing vertical line in Tinn R editor

2007-06-06 Thread Judith Flores
Hi,

   I haven't been able to figure out how to remove a
vertical line that appears when I open an r file. How
can I do this?

Thank you,

Judith


   

Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.

__
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] Removing vertical line in Tinn R editor

2007-06-06 Thread Christos Hatzis
Go to Options/Main/Editor
Click on EdgeColor and select white as the color (or to whatever color you
have set your page's background).  This will make the edge line disappear.

-Christos

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Judith Flores
 Sent: Wednesday, June 06, 2007 1:50 PM
 To: RHelp
 Subject: [R] Removing vertical line in Tinn R editor
 
 Hi,
 
I haven't been able to figure out how to remove a vertical 
 line that appears when I open an r file. How can I do this?
 
 Thank you,
 
 Judith
 
 

 __
 __
 Looking for a deal? Find great prices on flights and hotels 
 with Yahoo! FareChase.
 
 __
 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] Linear Discriminant Analysis

2007-06-06 Thread michael watson \(IAH-C\)
Region and Name are effectively the same variable
 
cor(olive[,4:11])

will also show you that there are strong correlations between some of the 
variables - this is something you might want to avoid



From: [EMAIL PROTECTED] on behalf of Soare Marcian-Alin
Sent: Wed 06/06/2007 4:45 PM
To: Uwe Ligges; R-help@stat.math.ethz.ch
Subject: Re: [R] Linear Discriminant Analysis



Thanks for explaining...

Im just sitting at the homework for 6 hours after taking for one week
antibiotica, because i had an amygdalitis...
I just wanted some tipps for solving this homework, but thanks, I will try
to get help on another way :)

I think i solved it, but I still get this Error :(

## Loading Data
library(MASS)
olive - url(
http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R;)
print(load(olive))
dim(olive)
summary(olive)

index - sample(nrow(olive), 286)

train  - olive[index,-11]
test   - olive[-index,-11]

summary(train)
summary(test)

table(train$Region)
table(test$Region)

# Linear Discriminant Analysis
z - lda(Region ~ . , train)
zn - predict(z, newdata=test)$class
mean(zn != test$Region)

2007/6/6, Uwe Ligges [EMAIL PROTECTED]:


 So what about asking your teacher (who seems to be Peter Filzmoser) and
 try to find out your homework yourself?
 You might want to think about some assumptions that must hold for LDA
 and look at the class of your explaining variables ...

 Uwe Ligges



 Soare Marcian-Alin wrote:
  Hello,
 
  I want to make a linear discriminant analysis for the dataset olive, and
 I
  get always this error:#
  Warning message:
  variables are collinear in: lda.default(x, grouping, ...)
 
  ## Loading Data
  library(MASS)
  olive - url(
 
 http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R
 )
  print(load(olive))
 
  y - 1:572
  x - sample(y)
  y1 - x[1:286]
 
  train - olive[y1,-11]
  test  - olive[-y1,-11]
 
  summary(train)
  summary(test)
 
  table(train$Region)
  table(test$Region)
 
  # Linear Discriminant Analysis
  z - lda(Region ~ . , train)
  predict(z, train)
 
  z - lda(Region ~ . , test)
  predict(z, test)
 
  Thanks in advance!
 
 
 
  
 
  __
  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.




--
Mit freundlichen Grüssen / Best Regards

Soare Marcian-Alin

[[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] problem with Axis labels

2007-06-06 Thread ramakanth reddy
Hi

I am using the pamr.plotsurvival fucntion to plot the KM curves,how can I 
change the x axis and y axis labels according to my interest.

Thanks




  Looking for people who are YOUR TYPE? Find them at in.groups.yahoo.com

__
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] handling a cancelled file.choose()

2007-06-06 Thread Ben Tupper
Hello,


I have a file reading function that prompts the user with a file dialog 
if a filename is not provided in the argument list.  It is desirable to 
return gracefully if the user selects Cancel, but file.choose() throws 
an error instead of returning something like a character.

  file.choose()
[1] /Users/ben/ben_idl.pref

  file.choose()
Error in file.choose() : file choice cancelled

I naively planned to use nchar() to test the length, assuming 
cancellation would return a zero-length character. That appears to be 
out of the question. Are there other options available in the base package?

Thanks!
Ben

__
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] [R-pkgs] R package: Mchtest - Monte Carlo hypothesis testing allowing Sequential Stopping

2007-06-06 Thread Fay, Michael (NIH/NIAID) [E]
Hi,

This is an announcement for a package that has been up on CRAN since March 2006 
but was never announced.

The package is Mchtest - for Monte Carlo hypothesis tests allowing sequential 
stopping.  The idea is to use the sequential probability ratio test boundaries 
to stop resampling for a Monte Carlo hypothesis test such as a bootstrap or 
permutation test. This means that you will take many samples when the p-value 
is close to the significance level (e.g., 0.05), but you may stop after a much  
fewer samples if it becomes clear that the p-value is either very likely to be 
less than or more than 0.05. 

The details are described in:

Fay, MP, Kim, H-J, and Hachey, M. (2007). On using Truncated 
Sequential Probability Ratio Test Boundaries for Monte Carlo Implementation of 
Hypothesis Tests. (to appear in Journal of Graphical and Computational 
Statistics).  
 http://www3.niaid.nih.gov/about/organization/dcr/BRB/staff/michael


Please let me know of any problems or if you have any comments. 


Mike

**
Michael P. Fay, PhD
Mathematical Statistician
National Institute of Allergy and Infectious Diseases
Tel: 301-451-5124   Fax:301-480-0912
(U.S. postal mail address)   
6700B Rockledge Drive MSC 7609
Bethesda, MD 20892-7609
(Overnight mail address)
6700-A Rockledge Drive, Room 5133
Bethesda, MD 20817
**

Disclaimer: 

The information in this e-mail and any of its attachments is confidential and 
may contain sensitive information. It should not be used by anyone who is not 
the original intended recipient. If you have received this e-mail in error 
please inform the sender and delete it from your mailbox or any other storage 
devices. National Institute of Allergy and Infectious Diseases shall not accept 
liability for any statements made that are sender's own and not expressly made 
on behalf of the NIAID by one of its representatives



[[alternative HTML version deleted]]

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

__
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] [R-pkgs] R Package: ssanv - Sample size adjustments for nonadherence and variability of input parameters

2007-06-06 Thread Fay, Michael (NIH/NIAID) [E]
Hi,

This is a late announcement for a package that has been up on CRAN since Feb 
2006. 

The package is called ssanv and it calculates sample sizes for two group tests 
with adjustments for nonadherence and variability of the input parameters. As 
an example, suppose you want a sample size for a two group difference in normal 
means but you get your estimate of your variance from a previous study. Then 
with this package, you can account for the variability of that variance 
estimate in your sample size calculations. The details are described in:



Fay, MP, Halloran, ME, Follmann, DA. Accounting for Variability 
in Sample Size Estimation with Applications to Nonadherence and Estimation of 
Variance and Effect Size. Biometrics 2007, 63: 465-474. 
http://www.blackwell-synergy.com/doi/abs/10./j.1541-0420.2006.00703.x


Please let me know of any problems with the package or have any comments.

Thanks, 


Mike



**
Michael P. Fay, PhD
Mathematical Statistician
National Institute of Allergy and Infectious Diseases
Tel: 301-451-5124   Fax:301-480-0912
(U.S. postal mail address)   
6700B Rockledge Drive MSC 7609
Bethesda, MD 20892-7609
(Overnight mail address)
6700-A Rockledge Drive, Room 5133
Bethesda, MD 20817
**

Disclaimer: 

The information in this e-mail and any of its attachments is confidential and 
may contain sensitive information. It should not be used by anyone who is not 
the original intended recipient. If you have received this e-mail in error 
please inform the sender and delete it from your mailbox or any other storage 
devices. National Institute of Allergy and Infectious Diseases shall not accept 
liability for any statements made that are sender's own and not expressly made 
on behalf of the NIAID by one of its representatives



[[alternative HTML version deleted]]

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

__
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] [R-pkgs] New Package: rateratio.test

2007-06-06 Thread Fay, Michael (NIH/NIAID) [E]
Hi,

I just uploaded a new package rateratio.test. The package contains one function 
of the same name and it performs an exact rate ratio test for Poisson counts.  
Unlike binom.test and fisher.test the p-values and confidence intervals are 
internally consistent. In other words, if the p-value implies that the null 
hypothesis should be rejected, then the confidence interval also implies that 
the null should be rejected. There is a vignette discussing this issue.


Mike


**
Michael P. Fay, PhD
Mathematical Statistician
National Institute of Allergy and Infectious Diseases
Tel: 301-451-5124   Fax:301-480-0912
(U.S. postal mail address)   
6700B Rockledge Drive MSC 7609
Bethesda, MD 20892-7609
(Overnight mail address)
6700-A Rockledge Drive, Room 5133
Bethesda, MD 20817
**

Disclaimer: 

The information in this e-mail and any of its attachments is confidential and 
may contain sensitive information. It should not be used by anyone who is not 
the original intended recipient. If you have received this e-mail in error 
please inform the sender and delete it from your mailbox or any other storage 
devices. National Institute of Allergy and Infectious Diseases shall not accept 
liability for any statements made that are sender's own and not expressly made 
on behalf of the NIAID by one of its representatives



[[alternative HTML version deleted]]

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

__
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] handling a cancelled file.choose()

2007-06-06 Thread Gabor Grothendieck
Try this:

tryCatch(file.choose(), error = function(e) )


On 6/6/07, Ben Tupper [EMAIL PROTECTED] wrote:
 Hello,


 I have a file reading function that prompts the user with a file dialog
 if a filename is not provided in the argument list.  It is desirable to
 return gracefully if the user selects Cancel, but file.choose() throws
 an error instead of returning something like a character.

   file.choose()
 [1] /Users/ben/ben_idl.pref

   file.choose()
 Error in file.choose() : file choice cancelled

 I naively planned to use nchar() to test the length, assuming
 cancellation would return a zero-length character. That appears to be
 out of the question. Are there other options available in the base package?

 Thanks!
 Ben

 __
 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] handling a cancelled file.choose()

2007-06-06 Thread Henrik Bengtsson
See ?tryCatch.

Example: Function returning NULL if cancelled:

fileChoose - function(...) {
  pathname - NULL;
  tryCatch({
pathname - file.choose();
  }, error = function(ex) {
  })
  pathname;
}

/Henrik

On 6/6/07, Ben Tupper [EMAIL PROTECTED] wrote:
 Hello,


 I have a file reading function that prompts the user with a file dialog
 if a filename is not provided in the argument list.  It is desirable to
 return gracefully if the user selects Cancel, but file.choose() throws
 an error instead of returning something like a character.

   file.choose()
 [1] /Users/ben/ben_idl.pref

   file.choose()
 Error in file.choose() : file choice cancelled

 I naively planned to use nchar() to test the length, assuming
 cancellation would return a zero-length character. That appears to be
 out of the question. Are there other options available in the base package?

 Thanks!
 Ben

 __
 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] handling a cancelled file.choose()

2007-06-06 Thread Deepayan Sarkar
On 6/6/07, Ben Tupper [EMAIL PROTECTED] wrote:
 Hello,


 I have a file reading function that prompts the user with a file dialog
 if a filename is not provided in the argument list.  It is desirable to
 return gracefully if the user selects Cancel, but file.choose() throws
 an error instead of returning something like a character.

   file.choose()
 [1] /Users/ben/ben_idl.pref

   file.choose()
 Error in file.choose() : file choice cancelled

 I naively planned to use nchar() to test the length, assuming
 cancellation would return a zero-length character. That appears to be
 out of the question. [...]

Not really, errors can be caught and handled. This seems to give the
behaviour you want:

tryCatch(file.choose(), error = function(e) )

-Deepayan

__
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] Multiple color schemes for barchart (lattice)

2007-06-06 Thread Sarah Hawley
Hello R-help.

I am trying to make a stacked barplot where the color of the sections of
each bar depend on another variable.

 myData[1:11,]
   score   percentmarker cellType Malignant
1  0 100.0 ESR1 (ER) Bladder.M(5) TRUE
2  0  80.0  PAX8 Bladder.M(5) TRUE
3  1  20.0  PAX8 Bladder.M(5) TRUE
4  0 100.0 ESR1 (ER)   Brain.N(3) FALSE
5  0 100.0  PAX8   Brain.N(3) FALSE
6  3 100.0 ESR1 (ER) Breast.M(11) TRUE
7  0 100.0  PAX8 Breast.M(11) TRUE
8  0  36.36364 ESR1 (ER) Cervix.M(11) TRUE
9  1   9.09091 ESR1 (ER) Cervix.M(11) TRUE
10 2  18.18182 ESR1 (ER) Cervix.M(11) TRUE
11 3  36.36364 ESR1 (ER) Cervix.M(11) TRUE

palette - palette(gray(seq(0, 1,len=4)))
trellis.par.set(list(par.xlab.text=list(cex=0.85)
   , superpose.polygon=list(col=palette())
   , axis.text=list(cex=0.8)))
  
 
barchart(percent~cellType|marker
, groups=score
, data=myData
, stack=TRUE
, xlab='N=Normal/Benign, M=Malignant'
, ylab='Percentage of Cores Staining'
, color=palette()
, auto.key = list(points = FALSE, rectangles = TRUE, space = top)
, scales=list(x=list(rot=70))
, layout=c(1,2))

I would like to make the color scheme of the bar differ according to the
variable 'Malignant' and add a second color scheme to the key.
 
Any help would be appreciated!
--Sarah

 
Sarah Hawley
Data Coordinator/Analyst
Canary Foundation
[EMAIL PROTECTED]
415.412.2533

www.canaryfoundation.org
Stopping cancer early...
the best possible investment!

__
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] handling a cancelled file.choose()

2007-06-06 Thread Ben Tupper
Deepayan Sarkar wrote:
 On 6/6/07, Ben Tupper [EMAIL PROTECTED] wrote:
 Hello,


 I have a file reading function that prompts the user with a file dialog
 if a filename is not provided in the argument list.  It is desirable to
 return gracefully if the user selects Cancel, but file.choose() throws
 an error instead of returning something like a character.

   file.choose()
 [1] /Users/ben/ben_idl.pref

   file.choose()
 Error in file.choose() : file choice cancelled

 I naively planned to use nchar() to test the length, assuming
 cancellation would return a zero-length character. That appears to be
 out of the question. [...]
 
 Not really, errors can be caught and handled. This seems to give the
 behaviour you want:
 
 tryCatch(file.choose(), error = function(e) )
 
 -Deepayan

Thanks all,

I am very pleased to know about conditions in the base package.  Slick!

Ben

__
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] Multiple color schemes for barchart (lattice)

2007-06-06 Thread hadley wickham
On 6/6/07, Sarah Hawley [EMAIL PROTECTED] wrote:
 Hello R-help.

 I am trying to make a stacked barplot where the color of the sections of
 each bar depend on another variable.

  myData[1:11,]
score   percentmarker cellType Malignant
 1  0 100.0 ESR1 (ER) Bladder.M(5) TRUE
 2  0  80.0  PAX8 Bladder.M(5) TRUE
 3  1  20.0  PAX8 Bladder.M(5) TRUE
 4  0 100.0 ESR1 (ER)   Brain.N(3) FALSE
 5  0 100.0  PAX8   Brain.N(3) FALSE
 6  3 100.0 ESR1 (ER) Breast.M(11) TRUE
 7  0 100.0  PAX8 Breast.M(11) TRUE
 8  0  36.36364 ESR1 (ER) Cervix.M(11) TRUE
 9  1   9.09091 ESR1 (ER) Cervix.M(11) TRUE
 10 2  18.18182 ESR1 (ER) Cervix.M(11) TRUE
 11 3  36.36364 ESR1 (ER) Cervix.M(11) TRUE

 palette - palette(gray(seq(0, 1,len=4)))
 trellis.par.set(list(par.xlab.text=list(cex=0.85)
, superpose.polygon=list(col=palette())
, axis.text=list(cex=0.8)))


 barchart(percent~cellType|marker
 , groups=score
 , data=myData
 , stack=TRUE
 , xlab='N=Normal/Benign, M=Malignant'
 , ylab='Percentage of Cores Staining'
 , color=palette()
 , auto.key = list(points = FALSE, rectangles = TRUE, space = top)
 , scales=list(x=list(rot=70))
 , layout=c(1,2))

 I would like to make the color scheme of the bar differ according to the
 variable 'Malignant' and add a second color scheme to the key.

It's pretty easy to do this with ggplot2 - see
http://had.co.nz/ggplot2/position_stack.html for some examples.

Hadley

__
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] compiling from source on Vista

2007-06-06 Thread Erin Hodgess
Dear R People:

In the R Installation and Administration manual, there is a note
that the process used to compile R from source will NOT work on Windows Vista.

Does anyone know if that situation has changed, please?

Thanks in advance!

Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

__
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] electre decision analysis methods

2007-06-06 Thread Benoît Lété
Hello,

Is there some library implementing the electre II and III multiple criteria
decision analysis methods in R?

Thanks in advance.

[[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] Multiple color schemes for barchart (lattice)

2007-06-06 Thread Deepayan Sarkar
On 6/6/07, Sarah Hawley [EMAIL PROTECTED] wrote:
 Hello R-help.

 I am trying to make a stacked barplot where the color of the sections of
 each bar depend on another variable.

  myData[1:11,]
score   percentmarker cellType Malignant
 1  0 100.0 ESR1 (ER) Bladder.M(5) TRUE
 2  0  80.0  PAX8 Bladder.M(5) TRUE
 3  1  20.0  PAX8 Bladder.M(5) TRUE
 4  0 100.0 ESR1 (ER)   Brain.N(3) FALSE
 5  0 100.0  PAX8   Brain.N(3) FALSE
 6  3 100.0 ESR1 (ER) Breast.M(11) TRUE
 7  0 100.0  PAX8 Breast.M(11) TRUE
 8  0  36.36364 ESR1 (ER) Cervix.M(11) TRUE
 9  1   9.09091 ESR1 (ER) Cervix.M(11) TRUE
 10 2  18.18182 ESR1 (ER) Cervix.M(11) TRUE
 11 3  36.36364 ESR1 (ER) Cervix.M(11) TRUE

 palette - palette(gray(seq(0, 1,len=4)))
 trellis.par.set(list(par.xlab.text=list(cex=0.85)
, superpose.polygon=list(col=palette())
, axis.text=list(cex=0.8)))


 barchart(percent~cellType|marker
 , groups=score
 , data=myData
 , stack=TRUE
 , xlab='N=Normal/Benign, M=Malignant'
 , ylab='Percentage of Cores Staining'
 , color=palette()
 , auto.key = list(points = FALSE, rectangles = TRUE, space = top)
 , scales=list(x=list(rot=70))
 , layout=c(1,2))

 I would like to make the color scheme of the bar differ according to the
 variable 'Malignant' and add a second color scheme to the key.

I may not have understood what you are looking for, but it seems like
you just need

groups = interaction(score, Malignant)

For example,

palette - palette(gray(seq(0, 1,len=8)))

trellis.par.set(list(par.xlab.text=list(cex=0.85)
  , superpose.polygon=list(col=palette())
  , axis.text=list(cex=0.8)))

barchart(percent~cellType|marker
   , groups= interaction(score, Malignant)
   , data=myData
   , stack=TRUE
   , xlab='N=Normal/Benign, M=Malignant'
   , ylab='Percentage of Cores Staining'
   # , color=palette() # not doing anything
   , auto.key = list(points = FALSE, rectangles = TRUE, space =
top, columns = 2)
   , scales=list(x=list(rot=70))
   , layout=c(1,2))

-Deepayan

__
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] Question: RMySQL bulk load/update one column, dbWriteTable()?

2007-06-06 Thread Chris Stubben

 I have a question reading using RMySQL trying to load one R vector into a
 table column.  To be more specifically, the table is there populated.  Now I
 add a new column and want to populate this.
 


Okay, this is more of an SQL question now, but you could just use dbWriteTable
and then do an multi-table update.



dbGetQuery(con, select * from tmp)

  id name
1  1A
2  2B
3  3C
4  4D
5  5E


dbSendQuery(con, alter table tmp add column r2 float)

## calculate some statistic for all or some ids in table


x-dataframe(id=1:5, r2=c(.1, .4, .9, .4,.7))


dbWriteTable(con, r2tmp,  x )


dbSendQuery(con, update tmp t, r2tmp r set t.r2=r.r2 where t.id=r.id)


dbGetQuery(con, select * from tmp)

  id name  r2
1  1A 0.1
2  2B 0.4
3  3C 0.9
4  4D 0.4
5  5E 0.7


Chris

__
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] Spectral analysis

2007-06-06 Thread David LEDU
Hi all,

I am dealing with paleoceanographic data and I have a C14 time serie and one 
other variable. I would like to perform a spectral analysis (fft or wavelet) 
and plot it. Unfortunately I don't know the exact script to do this. Does 
anybody could send me an example to perform my spectral analysis ?

I Thank you

David


  Changez de tête et de tenue tous les jours si vous le voulez ! Volez la 
vedette sur Yahoo! Québec Avatars 

[[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] correspondence analysis

2007-06-06 Thread Artem Mariupol


Thanks very much Jari, I appreciate your guidance.
I trust R very much, the only thing I can do is to dig up the methodology
behind the SPSS result (and of course behind the correspondence analysis
itself).
Regards,
am


Jari Oksanen wrote:
 
 Artem Mariupol artem.mariupol at gmail.com writes:
 
 
 Hello,
 
 I am new to R and I have a question about the difference between
 correspondence analysis in R and SPSS.
 This is the input table I am working with (4 products and 18 attributes):
 
  mytable
1  2  3  4  5 6  7  8  9 10 11 12 13 14 15 16 17 18
 1 15 11 20  4 14 7  1  2  1  4 12 12 17 19 11 20  9 10
 2 19 18 14 14 16 4 14 11 11 15 22 19 22 16 21 19 15 16
 3 16 13 10  9 15 4 10  7 11 13 18 17 14 14 16 16 13 11
 4 21 18 16 14 20 6 12 14 14 17 23 20 19 18 21 18 19 18
 
 I found the function corresp() in the package MASS, but the results are
 different from the output in SPSS. Also, I don't understand the
 coordinates;
 in the biplot I cannot find a -2 limit for example from the first product
 on
 any of the x axes.
 
 At a quick look, there is nothing strange in the result. Have you
 contacted SPSS
 and asked them to explain their deviant results?
 
 It seems that biplot.correspondence is undocumented. However, it has
 argument
 'type' which defaults to symmetric, other alternative being rows and
 columns. Intelligent guess is that this selects the scaling of row and
 column
 scores, and type=symmetric scales both. By selecting type=columns,
 only
 columns are scaled and the -2 value for a row will be displayed (which
 proves
 that the guess was correct).
 
 I don't have a clue how SPSS scales results, but I guess that the
 differences in
 the results may be due to different scalings. Function corresp gives you
 weighted orthonormal row and column scores, but scales these in the plot
 like
 specified. It may be that SPSS does the scaling already in the printout
 (and
 does not give you the choice of type?). Another possible source of
 difference is
 that corresp gives you canonical correlations whereas some other program
 or
 function may give you their squares, a.k.a. eigenvalues. Moreover, the
 sign is
 arbitrary so that negative and positive scores may be switched between
 programs. 
 
 I hope this helps, 
 
 Jari Oksanen
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/correspondence-analysis-tf3876129.html#a10997356
Sent from the R help mailing list archive at Nabble.com.

__
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] Metropolis-Hastings Markov Chain Monte Carlo in Spatstat

2007-06-06 Thread Kevin C Packard
I'm testing some different formulations of pairwise interaction point processes
in Spatstat (version 1.11-6) using R 2.5.0 on a Windows platform and I wish to
simulate them using the Metropolis-Hastings algorithm implemented with Spatstat.
Spatstat utilizes Fortran77 code with the preprocessor RatFor to do the
Metropolis-Hastings MCMC, but the Makefile is more complicated than any I have
worked with.
Any suggestions on how I could get started working with the Fortran code in
conjunction with RatFor is appreciated.

Sincerely,
Kevin

Kevin Packard
Department of Forestry, PhD student
Department of Statistics, MS student
Virginia Polytechnic Institute and State University
Blacksburg, Virginia, USA

__
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] Spectral analysis

2007-06-06 Thread Ted Harding
On 06-Jun-07 20:55:09, David LEDU wrote:
 Hi all,
 
 I am dealing with paleoceanographic data and I have a C14 time serie
 and one other variable. I would like to perform a spectral analysis
 (fft or wavelet) and plot it. Unfortunately I don't know the exact
 script to do this. Does anybody could send me an example to perform my
 spectral analysis ?
 
 I Thank you
 
 David

There are a lot of possible ramifications to your query,
but for a basic spectral analysis of a series you can use
the function spectrum() in the stats package.

What is the role of the other variable?

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 06-Jun-07   Time: 22:34:07
-- XFMail --

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


  1   2   >