Re: [R] Using clustering functions

2007-09-08 Thread Uwe Ligges


uv wrote:
 Hi. I need to use a few different clustering functions. I managed to run the
 kmeans() one which is in my stats library, but I can't use any function,
 such as agnes(), that is in my cluster library. Any idea how to access
 other libraries? 
 Thanks!


Both stats and cluster are packages, not libraries.
You need to call library(cluster) in order to load package cluster 
from your library before using agnes() and her friends.


Uwe Ligges

__
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] Warning message with aggregate function

2007-09-06 Thread Uwe Ligges


Xingwang Ye wrote:
 Dear all,
 When I use aggregate function as:
 
 attach(warpbreaks)
 aggregate(warpbreaks[, 1], list(wool = wool, tension = tension), sum)
 
 The results are right but I get a warning message:
 number of items to replace is not a multiple of replacement length.
 
 BTW: I use R version 2.4.1 in Ubuntu 7.04.


Does not happen for me, neither with R-2.4.1 nor with recent versions of 
R. Maybe you have redefined one of the used objects (aggregate, 
warpbreaks, wool, tension, sum) in one of your environments?

BTW: Is is always a bad idea to make much use of attach()...

Uwe Ligges


 Your kind solutions will be great appreciated.
 
 Best wishes
 
 Yours, sincerely,
 Xingwang Ye
 
 __
 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] how to extract t-test statistics from glm()?

2007-09-06 Thread Uwe Ligges


Bin Sun wrote:
 I need to extract t-test statistics from glm(). For example,
 
  
 
 Coefficients:
 
 Estimate Std. Error t value Pr(|t|)
 
 (Intercept)  46.219911.6310   3.974 0.000106 ***
 
 Var1  1.0440 0.5948   1.755 0.081088 .  
 
 Var2 -0.4717 2.0257  -0.233 0.816178
 
 Var3  0.2376 0.1454   1.635 0.104024
 
  
 
 And I want to put all the t-values (and if possible, only that is associated
 with one particular independent variable such as Var3) to another table that
 can be reused later. I'm new to R and your help is highly appreciated!
 



  coefficients(summary(glm()))

Uwe Ligges



 
 Eric
 
 
   [[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] creat list

2007-09-06 Thread Uwe Ligges


livia wrote:
 Hi, 
 
 I have a list named lista, which has 50 vectors and each vector has the
 length about 1200. I would like to creat a matrix out of lista. What I try
 now is cbind(lista[[1]],lista[[2]],...,lista[[50]]). I guess there would be
 an easy way of doing this. Could anyone give me some advice?


matrix(unlist(lista), ncol=50)

Uwe Ligges

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] problem formatting and positioning title in heatmap

2007-09-06 Thread Uwe Ligges


Mark W Kimpel wrote:
 I am using heatmap with the arguments below. The title size stays the 
 same no matter what I set cex.main to. Is this expected? Can I adjust 
 the title size in heatmap?
 
 Also, the position of the main title is at the very upper edge of the 
 output and if I use a \n to stack the title the upper line is out of 
 bounds and doesn't show up.
 
 I am outputting to pdf.
 
 Any help? Thanks, Mark


Use par() to set that parameter of the device as in:

par(cex.main=1)
heatmap(.)

Uwe Ligges


 heatmap(x = dataM, RowSideColors = RowSideColors, 
 ColSideColors=ColSideColors, main = title,
margins = c(50,50), scale= do.scale ,labRow=geneNames, 
 labCol=colLabels, col = hmcol, cex.main = 1,
cexRow = row.lab.mag, cexCol = col.lab.mag)
 
   sessionInfo()
 R version 2.6.0 Under development (unstable) (2007-08-29 r42686)
 i686-pc-linux-gnu
 
 locale:
 LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
 
 attached base packages:
 [1] splines   tools stats graphics  grDevices utils datasets
 [8] methods   base
 
 other attached packages:
   [1] RColorBrewer_1.0-1 MergeMaid_2.9.0MASS_7.2-36
   [4] rat2302_1.17.0 rat2302cdf_1.17.0  affycoretools_1.9.4
   [7] annaffy_1.9.1  KEGG_1.17.1GO_1.99.1
 [10] xtable_1.5-1   gcrma_2.9.1matchprobes_1.9.10
 [13] biomaRt_1.11.4 RCurl_0.8-3XML_1.92-1
 [16] GOstats_2.3.16 Category_2.3.30genefilter_1.15.11
 [19] survival_2.32  RBGL_1.13.6annotate_1.15.6
 [22] GO.db_1.99.1   AnnotationDbi_0.1.12   RSQLite_0.6-0
 [25] DBI_0.2-3  limma_2.11.11  affy_1.15.7
 [28] preprocessCore_0.99.12 affyio_1.5.8   Biobase_1.15.30
 [31] graph_1.15.14
 
 loaded via a namespace (and not attached):
 [1] cluster_1.11.7


__
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] kendalls tau c

2007-09-05 Thread Uwe Ligges


Barbara Diane-Spillmann wrote:
 dear all,
 
 does anybody know if cor.test with method=kendall calculates kendalls 
 tau a b or c? I need to get p values for kendalls tau c...


May I ask what the difference between Kendall's tau a, b and c is? Any 
references?

Uwe Ligges


 thank you very much for any kind of hint.
 
 Barbara


__
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] some problems with linebuffer; was: Bug?

2007-09-03 Thread Uwe Ligges


Johanna Hasmats wrote:
 Ok, attaching all files. You need to run it in the following order:
 
 parse.RData
 
 Korrelation.RData   I have reduced this script to only include the error
 part.
 
 
 Input files are in the following order:
 
 oligo.prest.out for parse.RData to work. Produces the next input file 
 
 oligolista for Korrelation.RData to work, which also needs the input file
 
 8_SkBr _13433630.gpr. 
 
 
 The function GenePixData can be found in the aroma package.
 
 Thank you for your help,


1. Package kth is unavailable for us.

2. I do not know anything about a package called aroma, it is neither 
on CRAN nor in the BioC repositories.

3. Can you please also try to make your example smaller?

4. The convention is to save R objects in .Rdata files, but to have R 
code in .R files.


Uwe Ligges




 Johanna
 
 
 
 
 
 
 
 
 ***
 Johanna Hasmats
 Royal Institute of Technology 
 AlbaNova University Center 
 Stockholm Center for Physics, Astronomy and Biotechnology 
 School of Molecular Biotechnology 
 Department of Gene Technology 
 Visiting address: 
 Roslagstullsbacken 21, Floor 3 
 106 91 Stockholm, Sweden 
 Delivering address: 
 Roslagsvägen 30 B
 104 06 Stockholm, Sweden 
 Phone (office) +46 8 553 783 44 
 Fax + 46 8 553 784 81 
 ** 
 
 -Original Message-
 From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] 
 Sent: Friday, August 31, 2007 8:12 PM
 To: Uwe Ligges
 Cc: Johanna Hasmats; r-help@stat.math.ethz.ch
 Subject: Re: [R] Bug?
 
 On 8/31/07, Uwe Ligges [EMAIL PROTECTED] wrote:

 Johanna Hasmats wrote:
 Hi!



 How can I get around in R 2.5.1 in Windows:



 Error in strsplit(linebuffer, ) : object linebuffer not found

 Why should this be a bug in R, if you have no object named linebuffer
 in the environments that are on the search path.
 
 This sounds like it could have something to do with the command
 completion mechanism through package rcompgen (which does use an
 internal variable called 'linebuffer'). Since this doesn't seem to be
 a common problem, you need to give us instructions on how to reproduce
 it.
 
 -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 on shardsplot

2007-08-31 Thread Uwe Ligges
Ebi, keisyu, or whatever your name is,

I know that this questions has already been answered by the shardplot 
author in a private thread, where this has been posted under a different 
name. Why do you obscure your real name on the list???

The answer by Nils Raabe was that shardsplot is intended to draw the 
cluster map but adding sample numbers is more difficult. His quick 
proposal that needs some minor tweaking is:

xycords - cbind(kronecker(1:14, rep(1,6)), rep(1:6, 14))
labs - sapply(1:nrow(xycords),
 function(x) paste(as.character(which(
   (iris.som3$visual[,1] + 1 == xycords[x,1]) *
   (iris.som3$visual[,2] + 1 == xycords[x,2])   == 1)),
collapse = ;))
text(cbind(xycords[,2], xycords[,1]), labs, cex=0.75)


Uwe Ligges



ebi wrote:
 Dear All,
 
 
 
 Would you please tell me how to display the sample No. on the map ?
 
 
 
 ---Below commands don't display the sample No.(from 1 to 150).---
 
 library(som)
 
 library(klaR)
 
 iris.som3 - som(iris[,1:4], xdim = 14,ydim = 6)
 
 library(klaR); opar- par(xpd = NA)
 
 shardsplot(iris.som3, data.or = iris,label = TRUE)
 
 legend(3.5,14.3, col = rainbow(3), xjust =0.5, yjust = 0,legend =
 levels(iris[, 5]),pch = 16, horiz = TRUE)
 
 par(opar)
 
 
 
 Ebi
 
   [[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] Bug?

2007-08-31 Thread Uwe Ligges


Johanna Hasmats wrote:
 Hi! 
 
  
 
 How can I get around in R 2.5.1 in Windows:
 
  
 
 Error in strsplit(linebuffer, ) : object linebuffer not found


Why should this be a bug in R, if you have no object named linebuffer 
in the environments that are on the search path.


Uwe Ligges



  
 
 It comes a few lines after the actual strsplit, and yesterday everything was
 fine…
 
  
 
 Thank you in advance
 
  
 
 Kindest regards,
 
  
 
  
 
 ***
 
 Johanna Hasmats
 
 Ph.D Student
 
 Royal Institute of Technology 
 
 AlbaNova University Center 
 
 Stockholm Center for Physics, Astronomy and Biotechnology 
 
 School of Molecular Biotechnology 
 
 Department of Gene Technology 
 
 Visiting address: 
 
 Roslagstullsbacken 21, Floor 3 
 
 106 91 Stockholm, Sweden 
 
 Delivering address: 
 
 Roslagsvägen 30 B
 
 104 06 Stockholm, Sweden 
 
 Phone (office) +46 8 553 783 44 
 
 Fax + 46 8 553 784 81 
 
 **
 
 
 
 
   [[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 and Windows Vista

2007-08-31 Thread Uwe Ligges


Jan Budczies wrote:
  
 Hello group,
  
 it is reported (R for Windows FAQ) that R runs under Windows Vista.
 However, does someone here have experience with R under Vista 64
 and large (3 or 4 GB) memory?

There is no 64-bit version of R for Windows available now. Mainly 
because there are no really stable gcc compilers available for that 
platform yet. You are welcome to contribute patches that make R work 
under  64-bit Vista with some compilers, of course.

Uwe Ligges



  
 Greeting - Jan Budczies
  
  
 
   [[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] Single plot multiple levels in x?

2007-08-31 Thread Uwe Ligges
What about something like:


library(lattice)
posi - seq (0.5, 62525, 199.233)
mydf - NULL
for (i in 1:5) {
   df1 - data.frame(i, posi)
   mydf - rbind(mydf, df1)
}
myy - rep(-100.01:100.01, length=nrow(mydf))
mydf - cbind(mydf, myy)
names(mydf) - c(State, Position, PctRecurr)
mydf$State - factor(mydf$State)

Then you can ask

xyplot(PctRecurr ~ Position | State, data=mydf, layout= c(5,1))

or perhaps:

xyplot(PctRecurr ~ Position | State, data=mydf, layout= c(5,1), 
scales=list(axs='i'))


Uwe Ligges





Richard Yanicky wrote:
 Uwe,
 
 
 Here is some code to create some data then a plot (The plot was done in 
 another package). The plot is included only to reference the structure of the 
 x-axis. I can't get R to do something similar.
 
 
 State - seq (1:5);
 posi - seq (0.5,62525,199.233)
 
 mydf-NULL;
 
 for ( i in 1:5) {
 
 df1-data.frame(i,posi);
 
 mydf - rbind(mydf,df1); }   
 
 myy-rep(-100.01:100.01,length=nrow(mydf));
 
 mydf-cbind(mydf,myy);
 
 names(mydf) - c(State,Position,Pct Recurr);
 
 
 
 
 I would like to somehow:
 
 
 plot(c(mydf[,1],mydf[,2]),mydf[,3]) and end up with the nested structure on 
 the x-axis.
 
 Thanks,
 
 Richard
 
 
 -Original Message-
 From: Uwe Ligges [EMAIL PROTECTED]
 Sent: Aug 30, 2007 10:50 AM
 To: Richard Yanicky [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Single plot multiple levels in x?



 Richard Yanicky wrote:
 Uwe,

 I have looked into lattice and can't seem to make this work. I can easily 
 make multiple panels but this isn't what I am looking to do. Any 
 suggestions on which functions to use? the axis function seems a natural 
 place to start but I still can't seem to make it happen.
 If lattice is not what you want, I do not understand what you mean. Can 
 you give a more elaborated example, please?

 Uwe


 HELP!


 Richard 

 -Original Message-
 From: Uwe Ligges [EMAIL PROTECTED]
 Sent: Aug 30, 2007 5:59 AM
 To: Richard Yanicky [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Single plot multiple levels in x?



 Richard Yanicky wrote:
 Plotting with 2 x axis?


 One axis inside another, for example salary within state,




 1-50 | 50 – 100 |  100+   |   1- 50 | 50 -100 | 100+ | …  
 repeated bins for salary
AL   !   AR
  ……  more states
 Sounds like the lattice package does exactly what you want, but without 
 any reproducible example.

 Uwe Ligges



 The values are all stored with a single data frame. I have tried 
 different things with the axis function and done many searches for 
 plotting. Can’t find a direct reference 


 Thanks.

 Richard

 __
 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] Incomplete output with `sn' library package

2007-08-31 Thread Uwe Ligges
The derived information matrix is not of full rank for your data.
See the code of the functions, which is not that hard to read.

Uwe Ligges





MANASI VYDYANATH wrote:
 You have my sincere apologies for the incompleteness of my message.   
 I have given the details below, including my dataset and my code.
 
 I'm using R, version 2.5.0. My OS is a Mac, (version Tiger).
 
 The sn package is Version 0.4-1
 
 My code was as follows:
 
   mydata - read.table(url(http://www.statsci.org/data/oz/ 
 ais.txt), header = T)
   attach(mydata)
   a - msn.fit(X = cbind(1,Ht,Wt), y = BMI, control = list(x.tol=1e-6))
   b - msn.mle(X=cbind(1,Ht,Wt), y=SSF)
   a
   b
 
 My problem is that neither the a nor the b output gives me any  
 standard errors - those should appear under $se. In both the  
 regressions, this field is left blank with NA under it. I would  
 appreciate some help on this matter - are the standard errors not  
 supposed to appear here, or is there something else I should put into  
 the inputs?
 
 Thank you once again for your time,
 
 Manasi
 
 
 
 On Aug 30, 2007, at 5:47 AM, Uwe Ligges wrote:
 

 MANASI VYDYANATH wrote:
 Dear R users:
 I have a question regarding the output for two of the functions  
 in  the `sn' package, which deals with the mle fitting of skew  
 normal  curves to linear regressions. I'm using the examples and  
 the dataset  given as an example in the online documentation for  
 this package, for  the functions `msn.fit' and `msn.mle'. I'm  
 following the example code  in the documentation for these two  
 functions exactly.
 Part of the data output is supposed to be se, which gives the   
 standard errors of the estimated coefficients. This particular  
 value  comes out as being NA in the examples given, but there  
 are three  coefficients in each case and no numerical problems  
 about why the  standard errors cannot be calculated.
 Am I setting this program up right? Is there some other command I   
 should use (or an option I need to use) to get the output to  
 display  standard errors of the coefficients?
 We cannot know if you use it right, since you have not given any  
 details on

 OS, R version, sn version, and particularly a reproducible example.

 As each R-help message tells in the footer:

 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

 Uwe Ligges







 Thank you for your time in reading this question -
 Cordially,
 Manasi
 __
 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.


Re: [R] gsub warning message

2007-08-31 Thread Uwe Ligges


Talbot Katz wrote:
 Hi.
 
 I am using R 2.5.1 on a Windows XP machine.  Here is an example of a piece 
 of code I was running in older versions of R on the same machine.  I am 
 looking for underscores and replacing them with periods.  This result is 
 from R 2.4.1:
 
 gsub ( \\_+,\.,AAA_I)
 [1] AAA.I
 
 Here is what I get in R 2.5.1:
 
 gsub ( \\_+,\.,AAA_I)
 [1] AAA.I
 Warning messages:
 1: '\.' is an unrecognized escape in a character string
 2: unrecognized escape removed from \.
 
 I still get the same result, which is what I want, but now I get a warning 
 message.  Am I actually doing something wrong that the previous versions of 
 R didn't warn me about?  Or is this warning message unwarranted?  Is there a 
 fully approved method for getting the same functionality?  Thanks!

Yes, correct usage is either
   gsub ( \\_+, ., AAA_I)
or
   gsub ( \\_+, \\., AAA_I)

Uwe Ligges



 --  TMK  --
 212-460-5430  home
 917-656-5351  cell
 
 __
 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] Incomplete output with `sn' library package

2007-08-30 Thread Uwe Ligges


MANASI VYDYANATH wrote:
 Dear R users:
 I have a question regarding the output for two of the functions in  
 the `sn' package, which deals with the mle fitting of skew normal  
 curves to linear regressions. I'm using the examples and the dataset  
 given as an example in the online documentation for this package, for  
 the functions `msn.fit' and `msn.mle'. I'm following the example code  
 in the documentation for these two functions exactly.
 Part of the data output is supposed to be se, which gives the  
 standard errors of the estimated coefficients. This particular value  
 comes out as being NA in the examples given, but there are three  
 coefficients in each case and no numerical problems about why the  
 standard errors cannot be calculated.
 Am I setting this program up right? Is there some other command I  
 should use (or an option I need to use) to get the output to display  
 standard errors of the coefficients?

We cannot know if you use it right, since you have not given any details on

OS, R version, sn version, and particularly a reproducible example.

As each R-help message tells in the footer:

PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Uwe Ligges







 Thank you for your time in reading this question -
 Cordially,
 Manasi
 
 __
 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] Simple Graph

2007-08-30 Thread Uwe Ligges


amna khan wrote:
 Hi Sir
 
 We use the function mpg() for ticks on axes. If we define more number of
 ticks then each tick is not labeled. How to label each tick on axes?

What is mpg()? Which version of R? Which device? Which OS?

I guess R cannot print more labels because the ticks are too dense, but 
there is no reproducible example in your message.

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Uwe Ligges


  Regards
 


__
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] Q: Mean, median and confidence intervals with functions summary boxplot.stats

2007-08-30 Thread Uwe Ligges


Tom Willems wrote:
 Dear R ussers,
 
 My question is,  How can my mean be outside the confidence intervals ?!
 
 I think i have the answer for it, but i would like to hear some other 
 ideas on it.
 
 First my data is not continuose but categorical, it is a titre calculated 
 on a dilution serie.
 It is stored as a column of values, and a column indicating the phase of 
 the trail.
 Theoreticaly it is possible to have a value ranging from 0 to 4, but in 
 practice, only sertain values will occure, and they will repeat.
 So it are frequencies.
 
 This is why i belief that it is better to work with a median than with a 
 mean, because it represents the cluster of values wich occure most.
 Below I only give one example, but the mean being below the lowest 
 confidence limit occures several times over different tests.
 
 does my answer seam reasonable, or should i perhapes use an other methode, 
 any sugestion?
 
 summary_1d  = summary(subset(eda_data,  phase=='1'  test=='test 
 1' ,select=lg_value), na.rm = T)
 conf_1d  = boxplot.stats(subset(eda_data,  phase=='1'  
 test=='test 1' ,select=lg_value))
 
 MeanMedian 95% Confidence Int. StDev.  
 Variance
 1.1981.681   1.4411.922 0.931
0.866


I do not understand which confidence has been calculated? Based on 
which assumptions / data? Is it pointwise or not? We need much more 
information - and if you think it is a problem with R or usage of R 
functions, then please give us a reproducible example.

Uwe Ligges



 Kind regards,
 Tom W.
 
 
 Disclaimer: click here
   [[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] How to signal the end of the table?

2007-08-30 Thread Uwe Ligges
What about trying to use a database system and make queries?
If you are at the end of a file, you will read elements of length 0...

Uwe Ligges



Yuchen Luo wrote:
 I am using a for loop to read a table row by row and I have to specify how
 many records are there in the table. I need to read row by row because the
 table is huge and the memory not large enough for the whole table.:
 
 
 
 number.of.records=100
 
 
 
 fp=file(abc.csv,r)
 
 pos=seek(fp, rw=read)
 
 for (i in 1:number.of.record){
 
 current.row=scan(file=fp, sep=',', what=list(count=1, cusip6=, idate=1,
 spread=1.1, vol252=1.1, vol1000=1.1, st_debt=1.1, lt_debt=1.1 , total_liab=
 1.1, cr=1.1,   shrout=1.1, prc=1.1, mkt_cap=1.1, rtng=1.1, sec=1.1, cr3m=1.1,
 cr5y=1.1, ust3m=1.1,  ust5y=1.1), flush=TRUE, nlines=1,quiet=T)
 
 ...
 
 }
 
 
 
 I need to know the number of records in the table and put it in the variable
 named number.of.records. When I have a new table that I do not know how
 many records it has, I use excel to open the file to figure it out and put
 it in variable  number.of.records. I often have many tables to try and
 every one of them has thousands of recordsit takes a lot of time and
 trouble to adjust the code every time I read a different table.
 
 
 
 I am wondering if I can change the for loop to a while loop:
 
 
 
 while (the end of the table has not been reached)
 
 {
 
 current.row=scan(file=fp, sep=',', what=list(count=1, cusip6=, idate=1,
 spread=1.1, vol252=1.1, vol1000=1.1, st_debt=1.1, lt_debt=1.1 , total_liab=
 1.1, cr=1.1,   shrout=1.1, prc=1.1, mkt_cap=1.1, rtng=1.1, sec=1.1, cr3m=1.1,
 cr5y=1.1, ust3m=1.1,  ust5y=1.1), flush=TRUE, nlines=1,quiet=T)
 
 ...
 
 }
 
 
 The problem is how to articulate while (the end of the table has not been
 reached), or equivalently, how to signal the end of the table?
 
 Best Wishes
 Yuchen Luo
 
   [[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] Single plot multiple levels in x?

2007-08-30 Thread Uwe Ligges


Richard Yanicky wrote:
 Plotting with 2 x axis?
 
 
 One axis inside another, for example salary within state,
 
 
 
 
 1-50 | 50 – 100 |  100+   |   1- 50 | 50 -100 | 100+ | …  repeated 
 bins for salary
AL   !   AR
  ……  more states


Sounds like the lattice package does exactly what you want, but without 
any reproducible example.

Uwe Ligges



 
 The values are all stored with a single data frame. I have tried different 
 things with the axis function and done many searches for plotting. Can’t find 
 a direct reference 
 
 
 Thanks.
 
 Richard
 
 __
 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] Simple Graph

2007-08-30 Thread Uwe Ligges


amna khan wrote:
 Hi Sir
 
 If I want 10 ticks on x-axis and 10 ticks on y-axis then I  use
 
 lab=c(10,10, 20)
 
 Here first 10 is for 10 ticks on x-axis, second 10 is for 10 ticks on y-axis
 and 20 is the lenght of x and y labels in characters.
 
 Now my question is that how I can label all 10 ticks on x-aixs and all 10
 ticks on y-axis, because R leaves some ticks unlabeled.


So either make the font size smaller or rotate the labels...

Uwe Ligges


 Thank You

__
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] Single plot multiple levels in x?

2007-08-30 Thread Uwe Ligges


Richard Yanicky wrote:
 Uwe,
 
 I have looked into lattice and can't seem to make this work. I can easily 
 make multiple panels but this isn't what I am looking to do. Any suggestions 
 on which functions to use? the axis function seems a natural place to start 
 but I still can't seem to make it happen.

If lattice is not what you want, I do not understand what you mean. Can 
you give a more elaborated example, please?

Uwe


 
 HELP!
 
 
 Richard 
 
 -Original Message-
 From: Uwe Ligges [EMAIL PROTECTED]
 Sent: Aug 30, 2007 5:59 AM
 To: Richard Yanicky [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Single plot multiple levels in x?



 Richard Yanicky wrote:
 Plotting with 2 x axis?


 One axis inside another, for example salary within state,




 1-50 | 50 – 100 |  100+   |   1- 50 | 50 -100 | 100+ | …  repeated 
 bins for salary
AL   !   AR  
……  more states

 Sounds like the lattice package does exactly what you want, but without 
 any reproducible example.

 Uwe Ligges



 The values are all stored with a single data frame. I have tried different 
 things with the axis function and done many searches for plotting. Can’t 
 find a direct reference 


 Thanks.

 Richard

 __
 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] sql query over local tables

2007-08-29 Thread Uwe Ligges


Jorge Cornejo Donoso wrote:
 Hi i have to table with IDs in each one.
 
 I want to make a join (as in sql) by the ID. Is any way to use the RODBC
 package (or other) in local tables (not a access, mysql, sql, etc. )  and
 made the join?


I guess you are looking for ?merge

Uwe Ligges


 
 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.


Re: [R] Recoding multiple columns consistently

2007-08-29 Thread Uwe Ligges


Ron Crump wrote:
 Hi,
 
 I have a dataframe that contains pedigree information;
 that is individual, sire and dam identities as separate
 columns. It also has date of birth.
 
 These identifiers are not numeric, or not sequential.
 
 Obviously, an identifier can appear in one or two columns,
 depending on whether it was a parent or not. These should
 be consistent.
 
 Not all identifiers appear in the individual column - it
 is possible for a parent not to have its own record if its
 parents were not known.
 
 Missing parental (sire and/or dam) identifiers can occur.
 
 I need to export the data for use in another program that
 requires the pedigree to be coded as integers, increasing
 with date of birth (therefore sire and dam always have
 lower identifiers than their offspring) and with missing
 values coded as 0.
 
 How would I go about doing this?
 
 And a second, simpler related question, if I have a column with
 n different values (may be strings or non-sequential integers)
 identifying levels (possibly with repeated occurences), how
 can I recode them to be sequential from 1 to n?


rank(x, ties.method=first)


For the question above you can do as follows, for example:
order() identifiers by date, make them unique() and assign them to a new 
levels object. Then make them ordered factors:
   factor(some_column, levels=levels, ordered = TRUE)
and then as.numeric(factor_object) is what you are going to get.

Uwe Ligges





 I can solve both problems in fortran, so could use loops to
 do it in R, but feel there should be quicker, more elegant,
 more R solution.
 
 Thanks for your help.
 
 Ron.
 
 __
 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] attempt at making a polygon class failed

2007-08-29 Thread Uwe Ligges


Leeds, Mark (IED) wrote:
 I was reading a presentation of Professor Peng's and typed the
 presentation code into R but I changed it to make plot.polygon a 
 separate function instread of defining the function in SetMethod itself
 as he did. Is that the problem with the code below because
 plot(p) just gives me zero. Thanks.
 
 
 setClass(polygon, representation(x = numeric,
  y = numeric))
 
 plot - function(object)
   {
   return(0)
   }


If you redefine plot this way, you cannot use a call to the generic plot 
within the plot.polygon function any more.
Hence do *not* define the new plot() function above. The rest should work.

Uwe Ligges




 setGeneric(plot)
 
 plot.polygon - function(x, y, ...) {
   xlim - range([EMAIL PROTECTED])
   ylim - range([EMAIL PROTECTED])
   plot(0,0, type = n, xlim = xlim, ylim = ylim, ...)
   xp - c([EMAIL PROTECTED], [EMAIL PROTECTED])
   yp - c([EMAIL PROTECTED], [EMAIL PROTECTED])
   lines(xp, yp)
 }
 
 setMethod(plot,polygon,plot.polygon)
 
 p - new(polygon, x = c(1,2,3,4), y = c(1,2,3,1))
 
 plot(p)
 
 
 This is not an offer (or solicitation of an offer) to buy/se...{{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.

__
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] xeon processor and ATLAS

2007-08-29 Thread Uwe Ligges


Prof Brian Ripley wrote:
 On Tue, 28 Aug 2007, hui xie wrote:
 
 hi everyone:

 I have a Dell Server that has a Xeon processor, and I would like to use 
 the best ATLAS posted in the R website. I find that R has ATLAS for 
 core2duo and P4. I am not sure which one of these two is best suited for 
 Xeon processor, or is that neither of these two is good and I should 
 stick with the default one that was installed originally?
 
 And your OS is?
 
 There are many different 'Xeon' processors with very different 
 capabilities.  

... the earlier similar to P4 and some similar to Core2Duo. You won't 
make use of bigger L2/L3 caches in Xeon processors.

  You really ought to build ATLAS for yourself if numerical
 linear algebra performance matters to you (and it makes little difference 
 to most people: I think Uwe Ligges quoted 10% for testing all CRAN 
 packages).


Right, it depends on what you are really doing. If most time is spend in 
certain numerical matrix operations, ATLAS is your friend. In all other 
cases, it does not matter so much, as Brian cited correctly.

Uwe Ligges


 
 Your advice is very much appreciated!

 Best,

 Hui


 -
 Park yourself in front of a world of choices in alternative vehicles.

  [[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.
 
 Please do!
 


__
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] Histogram Title SizeFont

2007-08-29 Thread Uwe Ligges


livia wrote:
 Hello, I would like to plot a histogram with title Return, and I would like
 the font for the title to be Bold and the size to be 8( as in Excel).
 
 I tried the following code, but it does not make any change. Could anyone
 give me some advice?

See ?par.

Uwe Ligges



 hist (preturn, seq(-0.05,0.05,0.005),freq = FALSE, main=Return, font=2,
 cex=8,xlab=return,xlim=c(-0.05,0.05))
 
 Many 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.


Re: [R] Plot command drops part of the plot for large plots in multiple figure environment

2007-08-29 Thread Uwe Ligges
Your examples are not reproducible. Hence hard to tell what goes wrong.
There never was an R version 1.51.
Please use a current version of R and read the pposoting guide.

Uwe Ligges





Lindveld, Charles wrote:
 I have run into some surprising behaviour when plotting data in a 3x2
 grid:
 random parts of the data on my graphs aren't rendered. Not on screen,
 not on file,
 and not when I send the plot to a printer. I don't get any error
 messages either.
  
 When I do the individual plots (not in a grid) they are each rendered
 correctly.
  
 
 My questions are:
  - Has anyone encountered something like this, or is it particular to my
installation?
  - Have I hit one of R's limits, and can I increase that limit?
  - Would there be any workarounds that will allow me to get those 6
 graphs
in one single plot without thinning the data?
  
  
 The circumstances of the problem are:
  
 The data I am plotting consists of 4 dataframes and 4 strings:
  
 d1 - d4 are dataframes of dimension 308160 x 21 that contain a column
 named det_ok_num.
 BPS1 - BPS4 are strings
  
 I'm running R 1.51 under Windows XP and I have 2 Gb of core memory, 800
 Mb free, and 5 Gb swappable. 
 All variables are in memory; the total amount of memory used by the Rgui
 process is slightly less than 400Mb. 
  
 
 The plot command I use is
 Fplot6_Det_OK (d1, d2, d3, d4, d1, d2, BPS1, BPS2, BPS3, BPS4, BPS1,
 BPS2)
  
 I am using the following two small plot functions:
  
 Fplot6_Det_OK = function(d1, d2, d3, d4, d5, d6, BPS1, BPS2, BPS3, BPS4,
 BPS5, BPS6) {
 # Purpose: Plot detector status for MONICA loops
 #  make 3x2 subplot window and plot 6 loops
 #
 #
  
 op - par(no.readonly = TRUE)
  
 par_plot6 - par(mfrow = c(3, 2))
  
 FplotDetOK (d1, BPS1)
 FplotDetOK (d2, BPS2)
 FplotDetOK (d3, BPS3)
 FplotDetOK (d4, BPS4)
 FplotDetOK (d5, BPS5)
 FplotDetOK (d6, BPS6)
  
 par(op)
 }
  
  
  FplotDetOK = function(d, BPS) {
 # Purpose: Plot detector status for MONICA loops
 #
 #
  
 subtitleStr = paste (BPS = , BPS)
 plot(d$det_ok_num, pch=., col=blue, sub = subtitleStr)
 }
 
  
 Charles Lindveld
 Centre for Transport Studies
 Imperial College London
  
 
   [[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] xeon processor and ATLAS

2007-08-29 Thread Uwe Ligges


hui xie wrote:
 Thanks very much for all your advice. To be clear, my OS is window
 XP. I bought this server last year. It's Dell Precision PWS690. THe
 processor is Xeon(TM) CPU 3GHZ, 2G RAM. I am not sure how to check
 more details of processor on my computer. But I went to Dell website
 and from what I can recall, it seemed that I ordered a Dual-core
 Intel Xeon 5160 3GHz, 1333FSB, 4MB L2 Cache, 80watts.
 I think from time to time, I will need linear algebra to do things
 such as Choleskey Factorization, and matrix inverse etc... At the
 same time, I considered myself quite unskilled on building R by
 myself. It seems there were lots of details that I can get things
 wrong. So if there is an existing ATLAS one on R website that I can
 use, I would be very happy to use it to replace the default one. The
 reason why I would like to use ATLAS is that R FAQ said :
 
 The savings can be appreciable: on a 2.6GHz P4 and a 1000 x 1000
 matrix svd took 16.2 sec with the standard BLAS and 7.8 sec with
 ATLAS.  Because ATLAS is tuned to a particular chip we can't use it
 generally: the optimal routines for a P4 or an Athlon XP are quite
 different and neither will run at all on a PII.
 
 This seems to me an impressive gain to use the correct ATLAS instead
 of the default BLAS.  I guess my  Xeon processor is either a P4 or
 Core2Duo, but I am really not sure which one to use. Could you please
 offer me some suggestions?


As a Google search tells you, the Xeon 5100 series is Core2 based while 
5000 and former CPUs were NetBurst based.

Uwe Ligges



 Again, many thanks for all your advice!
 
 Best,
 
 Hui
 
 Uwe Ligges [EMAIL PROTECTED] wrote:
 
 Prof Brian Ripley wrote:
 On Tue, 28 Aug 2007, hui xie wrote:
 
 hi everyone:
 
 I have a Dell Server that has a Xeon processor, and I would like
 to use the best ATLAS posted in the R website. I find that R has
 ATLAS for core2duo and P4. I am not sure which one of these two
 is best suited for Xeon processor, or is that neither of these
 two is good and I should stick with the default one that was
 installed originally?
 And your OS is?
 
 There are many different 'Xeon' processors with very different 
 capabilities.
 
 ... the earlier similar to P4 and some similar to Core2Duo. You won't
  make use of bigger L2/L3 caches in Xeon processors.
 
 You really ought to build ATLAS for yourself if numerical linear
 algebra performance matters to you (and it makes little difference
  to most people: I think Uwe Ligges quoted 10% for testing all CRAN
  packages).
 
 
 Right, it depends on what you are really doing. If most time is spend
 in certain numerical matrix operations, ATLAS is your friend. In all
 other cases, it does not matter so much, as Brian cited correctly.
 
 Uwe Ligges
 
 
 Your advice is very much appreciated!
 
 Best,
 
 Hui
 
 
 - Park yourself in front of a
 world of choices in alternative vehicles.
 
 [[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.
 Please do!
 
 
 
 
 
 - Yahoo! oneSearch: Finally,  mobile
 search that gives answers, not web links.

__
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] outdated R and package dependencies; was: R Help

2007-08-28 Thread Uwe Ligges


Ola Asteman wrote:
 
 I got the Warning message below when I tried to load Locfit. What is wrong?


Please read the posting guide which suggests to use a sensible subject line.



 Regards
 Ola Asteman
 
 --
 
 R version 2.4.0 (2006-10-03)


It makes sense to upgrade to a recent version of R.



 Copyright (C) 2006 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.
 
 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.
 
 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.
 
 library(foreign)
 library(mgcv)
 This is mgcv 1.3-19
 library(locfit)

How was locfit installed?

   install.packages(locfit, dependencies = TRUE)

should also install the package's dependencies - and you have not all 
installed, among them akima.

Uwe Ligges





 Loading required package: akima
 Error: package 'akima' could not be loaded
 In addition: Warning message:
 there is no package called 'akima' in: library(pkg, character.only = TRUE,
 logical = TRUE, lib.loc = lib.loc)
 
 
 
 --
 This e-mail and any attachment may be confidential and may a...{{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.

__
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] changing text direction of mtext

2007-08-24 Thread Uwe Ligges
squall44 wrote:
 Hello,
 
 Does anyone know if it's possible to change the text direction of mtext?
 
 I'd like to use 'mtext(side=2)' but the text should be 'left-to-right'.
 
 I couldn't find an argument for that in the help files.


It's just one help file you have to read: ?mtext. Please also read the 
introductory R manuals (and maybe look into some good textbook on R).
Since we all do know now that you cannot read help pages, I read ?mtext 
for you:

In section Arguments:
... Further graphical parameters (see par), including family, las and 
xpd. (This defaults to the figure region unless outer = TRUE, otherwise 
the device region. It can only be increased.) 

In section Details:
Parameter las will determine the orientation of the string(s). For 
strings plotted perpendicular to the axis the default justification is 
to place the end of the string nearest the axis on the specified line. 
(Note that this differs from S, which uses srt if at is supplied and las 
if it is not.)

Please also note that you can look into the R-help archives before 
posting questions that have been answered dozens of times already - as 
the posting guide to this list asks you to do.

Uwe Ligges




 Thanks for any suggestions
 Tobias

__
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] as.numeric : what goes wrong?

2007-08-24 Thread Uwe Ligges


Wolfgang Polasek wrote:
 I have a character vector j1 created from dimnames and want it to convert it
 to numeric.
 Like the first element:
 
 j1[1]
   f896
 1  896


Probably this is a factor?


 as.numeric(j1[1])
 [1] 1990

And this is the number the factor level 896 has been coded with.


?factor tells us:

The interpretation of a factor depends on both the codes and the 
levels attribute. Be careful only to compare factors with the same set 
of levels (in the same order). In particular, as.numeric applied to a 
factor is meaningless, and may happen by implicit coercion. To “revert” 
a factor f to its original numeric values, as.numeric(levels(f))[f] is 
recommended and slightly more efficient than as.numeric(as.character(f)).

Hence as.numeric(levels(f))[f] is the way to go.

Best,
Uwe Ligges



 why is it not 896 as it should be?
 This is true fr the whole vector.
 
 Thanks
 W.P.
 
   [[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] Two graphs, align vertically

2007-08-23 Thread Uwe Ligges


squall44 wrote:
 Hi,
 
 I created an ecdf and a boxplot. Now I would like to place the ecdf above
 the boxplot.
 But I only managed to align them horizontally. I used this code:
 
 #---
 par(mfrow=c(1,2), mar=c(5,3,3,1))


As in the message before: Please read the help pages more carefully! You 
found par(mfrow), what about reading the help page and switching to c(2,1)?

Uwe Ligges


 # ecdf
 library(plotrix)
 x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
 F2.5 - ecdf(x)
 plot(F2.5,
   verticals= TRUE,
   do.p = TRUE,
   lwd=3,
   ylab = ,
   xlab = ,
   main = Figur 2.5 Empirische Verteilfunktion,
   xlim = c(1,5.5))
 abline(h= (0:5)*0.2)
 staxlab(at=x,labels=paste(X[,1:10,],sep=),nlines=3,top.line=2,
 line.spacing=1, cex=0.8)
 
 #boxplot
 F26-boxplot(x,
  horizontal=TRUE,
  main=Figur 2.6 Der Boxplot,
  axes=FALSE,
  varwidth=TRUE)
 #---
 
 Can anyone tell me how I need to change the code to align the two graphs
 vertically?
 Thanks in advance
 Tobias


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

2007-08-23 Thread Uwe Ligges


squall44 wrote:
 Hello,
 
 I wanted to create a histogram, but somehow I got stuck...
 
 The interval limits are: x = 1, 2, 3, 3.5, 4.5, 5, 5.5
 The interval widths are therefore: 1, 1, 0.5, 1, 0.5, 0.5


Please read the help page more carefully! See ?hist and its argument 
breaks.

Uwe Ligges

 Nothing I tried worked... Can anyone help me please?
 Thanks
 Tobias

__
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] two labels on x-axis (year and month)

2007-08-23 Thread Uwe Ligges


[EMAIL PROTECTED] wrote:
 hej
 
 i'm plotting time-series and label the x-axis as follows:
 
 r - as.POSIXct(round(range(p1$time), month))
 
 to define the time range for labeling the xaxis
 
 plot(p1$time,p1$ p1, type=l, xaxt=n)
 
 plots p1 against time
 
 axis.POSIXct(1, at=seq(r[1], r[2], by=month), format=%m)
 
 labels the axis in mothly steps.
 
 what I want do do now, is a second label for the x-axis, that stands lower 
 and indicates the years.
 
 like 05 06 07 08 09 10 11 12 01 02 03 04 05 etc...
  2004  2005
 I don't know how to proceed with all the possibilities in axis, par and plot

You can add the year numbers manually with mtext() (for plotting text 
into the margins).

Uwe Ligges




 thanks for your help
 
 __
 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] Histogram

2007-08-23 Thread Uwe Ligges


squall44 wrote:
 Well, that was the first thing I tried. But the help only gives you the
 commands and does not explain how to use it (I am a newbe). How do I use the
 argument 'breaks'?
 I tried:
 #---
 x = c(1, 2, 3, 3.5, 4.5, 5, 5.5)
 breaks=c(1, 1, 0.5, 1, 0.5, 0.5)
 
 hist(x,
  breaks= breaks,
  xlim=c(0,7),
  ylim=c(0,5))
 #---
 ...which didn't work.


Well, breaks means breaks, not the widths of the bins, hence
   hist(youData, breaks = c(1, 2, 3, 3.5, 4.5, 5, 5.5))
is what you want, but that is meaningsless since you have not yet given 
any data.

Uwe Ligges


 I tried many other variations, but I am a beginner. If anyone can give me a
 clue, I'd be very thankful.
 Tobias
 
 
 
 Uwe Ligges wrote:


 squall44 wrote:
 Hello,

 I wanted to create a histogram, but somehow I got stuck...

 The interval limits are: x = 1, 2, 3, 3.5, 4.5, 5, 5.5
 The interval widths are therefore: 1, 1, 0.5, 1, 0.5, 0.5

 Please read the help page more carefully! See ?hist and its argument 
 breaks.

 Uwe Ligges

 Nothing I tried worked... Can anyone help me please?
 Thanks
 Tobias
 __
 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] rectify a program of seasonal dummies matrix

2007-08-22 Thread Uwe Ligges


Friedrich Schuster wrote:
 Hello, 
  
 the main problem seems to be the if else, should be else if. 
 
 Your code is hard to read, maybe you should consider using more () {}: 
 
 T - 100;
 br - matrix(0,T,4);

Thanks for the contribution. Please note:
a) It is a bad idea to have a variable called T. Some people still use 
it as a logical value even if they should not.
b) R does not need any ; at the end of a line.

Uwe Ligges


 for (i in 1:T) {
for (j in 1:4) {
   if (i==j) {
  br[i,j] - 1;
}
else if ((abs(i-j)%%4)==0) {
   br[i,j] - 1;
 }
 else {
   br[i,j] - 0;
 }
 }
  }
 
 A simpler approach is creating a diagonal matrix and multply it : 
 
 # create small diagonal matrix
 mat = diag(x=1, nrow=4, ncol=4);
 mat
 # multiply diagonal matrix and re-dimension it   to 4 cols
 br - rep(mat, 25);
 dim(br) - c(100, 4);
 br;
 
 Hope this helps, 
 FS


__
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 Sampling from a Matrix

2007-08-22 Thread Uwe Ligges


Anup Nandialath wrote:
 Dear Friends,
 
 I have a matrix of size 5000 X 20. The first two columns are indicator 
 variables taking the value of either 0 or 1. Let us call the first two 
 columns Y1 and Y2. 
 
 I need to randomly sample 1000 rows with all the associated columns, in other 
 words my new matrix should be of size 1000 X 20. I realize that using this 
 command
 
  newmat - mainmat[sample(1000,replace=F),]
 
 achieves this. However, I would like to make sure that both Y1 and Y2 have 
 more or less an equal amount of 0's and 1's. At present when I sample, I get 
 cases where sometimes all my Y2's are 0. Is there any way to accomodate this 
 problem.


Yes, for example drawing samples stratified by the values of Y1 or Y2.

Uwe Ligges



 Thanks in advance.
 
 Regards
 
 Anup
 

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

2007-08-20 Thread Uwe Ligges


Shubha Vishwanath Karanth wrote:
 Hi,
 
  
 
 Could anyone tell me what is the command used in R to do 
 
 1.Differentiation

See ?deriv and note that R is numerical software and only has limited 
capabilities for symbolic mathematics such as differentiation.


 2.Newton Raphson method (Numerical Analysis in general...)

For numerical optimization see ?optim which implements several methods.

Uwe Ligges



  
 
 Are there any packages separately for this?
 
  
 
 Thanks for your help!
 
  
 
 BR, Shubha
 
 
   [[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] Labelling certain points on the x-axis

2007-08-20 Thread Uwe Ligges


squall44 wrote:
 Hello,
 
 I created an empirical distribution function:
 
 x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
 F2.5 - ecdf(x)
 plot(F2.5, 
  verticals= TRUE, 
  do.p = TRUE, 
  lwd=3, 
  ylab = f(x), 
  xlab = x, 
  main = Figur 2.5 Empirische Verteilfunktion, 
  xlim = c(1,5.5))
 abline(h= (0:5)*0.2)

See ?mtext for adding text into the margins.

Uwe Ligges



 Now I would like to label the points on the x-axis where there is an
 x-value:
 
 http://www.nabble.com/file/p12231344/figur.gif 
 
 I don't know how to do that... can anyone help me?
 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.


Re: [R] Question about writing some code

2007-08-20 Thread Uwe Ligges


squall44 wrote:
 Just a short question:
 Why does this work:
 
 x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
 F26-boxplot(x,
 add=FALSE,
 horizontal=TRUE,
 main=Figur 2.6 Boxplot,
 axes=FALSE)


boxplot returns some information on the boxplot, but the result cannot 
be plotted by boxplot itself. You can use bxp() to do so.

Uwe Ligges



 ...but this doesn't...
 
 x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
 F26 - boxplot(x)
 plot(F26,
 add=FALSE,
 horizontal=TRUE,
 main=Figur 2.6 Boxplot,
 axes=FALSE)
 
 Thanks for any help,
 Squall44

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with lsa package (data.frame) on Windows XP

2007-08-19 Thread Uwe Ligges
Please specify reproducible examples, it is almost impossible to help 
otherwise. Also, please provide all error messages and a traceback(). 
Please tell us versions of R and versions of the packages you are using.
If you are sure this is an error in the package, please send that 
reproducible example to the package maintainer.

Uwe Ligges


Walter Rojas wrote:
 Dear R team,
 
 The following piece of code (to use the lsa package) works fine on my  
 mac os x, but when I run the same code on Windows XP, it doesn't work  
 any more.
 
 ### code:
 library(lsa)
 matrix1 = textmatrix(C:\\Documents and Settings\\tine stalmans.TINE. 
 000\\LSA\\cuentos\\, stemming=TRUE, language=spanish,  
 minWordLength=2, minDocFreq=1, stopwords=NULL, vocabulary=NULL)
 print(matrix1,bag_lines = 3, bag_cols = 3)
 matrix1 = lw_bintf(matrix1) * gw_idf(matrix1)
 space = lsa(matrix1, dims = dimcalc_share())
 as.textmatrix(space)
 
 ### the following line fails on windows XP
 matrix2 = textmatrix(C:\\Documents and Settings\\tine stalmans.TINE. 
 000\\LSA\\respuestas\\, stemming=TRUE, language=spanish,  
 minWordLength=2, minDocFreq=1, stopwords=NULL,vocabulary=rownames 
 (matrix1))
 matrix2 = lw_bintf(matrix2)
 matrix2fld = fold_in(matrix2, space)
 r - cor(matrix2fld[,respId1.txt], matrix2fld[,respAl1.txt],  
 method = pearson)
 print(r)
 
 
 An error occurs when creating the second textmatrix with the  
 vocabulary of the first. The error I get is:
 
 in data.frame(docs = basename(file), terms = names(tab), Freq = tab,  :
  arguments imply differing number of rows: 1, 0
 
 When I change the vocabulary argument to NULL, it doesn't report this  
 error any more; however, then the code will fail on the fold_in  
 method further down.
 
 I found another user who reported this same problem on-line; however,  
 I didn't find any answers.
 
 Thank you very much in advance for your reply.
 Tine.
 
 __
 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] Is there any good tools to facilitate us to create R functions?

2007-08-17 Thread Uwe Ligges


zhijie zhang wrote:
 Dear R users,
   We have some programs for the specific task in our research, but they were
 very commonly used. We want to make some functions for them, anybody can
 recommend any good tools to facilitate us to create R functions even without
 going deep into the theories of R functions ?
   Any suggestions or help are greatly appreciated.
 

The tool is a) a manual, b) your eye, and after that c) your keyboard.
So, what is your program if it is not a function?
If my guess is right and your programm is a sequence of many lines of R 
code: given you have a program that calculates the square root of x, then

myfoo - function(x){
sqrt(x)
}

is your function:

myfoo(4)

Uwe Ligges

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

2007-08-14 Thread Uwe Ligges


Safaa Najla wrote:
 Good Morning
 i am in doctorate.
 i want to ask for the packages of R,
 i tried to install it, 

What? R or packages?
How did you try it, please give us more details as suggested in the 
posting guide!

  but it appears  not found.

Complete error message, please.

 each time i have to 
 delete and install again the programme R.

Why?


 Are there another method for installing the package?

Which one are we talking about? Or do you mean R itself? In that case, 
what is your OS etc.? Again, please read the posting guide.

Uwe Ligges


 thank you
 
 __
 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] need help to manipulate function and time interval

2007-08-13 Thread Uwe Ligges


KOITA Lassana - STAC/ACE wrote:
 Hi,
 data are extracted from MS Access with the format: (%d/%m%Y %H%M%S); ex: 
 16/09/2006 03:38:37


1. the example you gave in your first message is still not reproducible, 
you gave the following:

myfunc - function(mytab, Time, Level)
{
vect - rep(0, length(mytab))
for(i in 1:length(vect))
{
 for(j in 1:length(Time))
 if(time[j] is between 18:00:00 and 23:59:59)
 L[i] - L[j]+5
 vect[i] - 10^((L[i])/10
 if (time[j] is between 22:00:00 and 05:59:59)
 L[i] - L[j]+10
 vect[i] - 10^((L[i])/10
 else
 L[i] = L[j]
 vect[i] - 10^((L[i])/10
  }
}


a) Please check the parentheses  (some closing ) are missing, you also 
probably want to group some code {} that is executed in some of the 
if conditions rather than executing the (syntactically erroneous) line
   vect[i] - 10^((L[i])/10
three times for each inner loop. Particularly, the else is 
syntactically incorrect with not preceding if.

So my guess is you want something like


myfunc - function(mytab, Time, Level)
{
vect - rep(0, length(mytab))
for(i in 1:length(vect))
{
 for(j in 1:length(Time))
 {
 if(time[j] is between 18:00:00 and 23:59:59){
 L[i] - L[j]+5
 vect[i] - 10^(L[i]/10)
 }
 if (time[j] is between 22:00:00 and 05:59:59){
 L[i] - L[j]+10
 vect[i] - 10^(L[i]/10)
 } else {
 L[i] - L[j]
 vect[i] - 10^(L[i]/10)
 }
 }
}

But I am really not sure about that and why you subsitute L[i] so many 
times...!


b) What are mytab, Time and Level?


2. Which is the format do you have?
(%d/%m%Y %H%M%S)
*or*
16/09/2006 03:38:37
If the latter, you can use
dat - strptime(16/09/2006 03:38:37, %d/%m/%Y %H:%M:%S)
in order to get some POSIXlt object for later calculations.


3. What do you mean with
time[j] is between 22:00:00 and 05:59:59
Is the day of the date important or not for this comparison?

Uwe Ligges












 I still have error messneger
 
 Thank you for your help. 
 
 Lassana KOITA 
 Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique  / 
 Project Engineer Airport Safety Studies  Statistical analysis
 Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical 
 Department 
 Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation 
 Headquarters
 Tel: 01 49 56 80 60
 Fax: 01 49 56 82 14
 E-mail: [EMAIL PROTECTED]
 http://www.stac.aviation-civile.gouv.fr/
 
 
 
 Uwe Ligges [EMAIL PROTECTED] 
 12/08/2007 15:24
 
 A
 Matthew Walker [EMAIL PROTECTED]
 cc
 Henrique Dallazuanna [EMAIL PROTECTED], r-help@stat.math.ethz.ch, KOITA 
 Lassana - STAC/ACE [EMAIL PROTECTED]
 Objet
 Re: [R] need help to manipulate function and time interval
 
 
 
 
 
 
 
 
 Matthew Walker wrote:
 Uwe Ligges wrote:
 Henrique Dallazuanna wrote:

 Hi,

 Try whit:

 if(time[j] = 18:00:00   23:59:59)

 This code is obviously wrong and does not help for the next few lines 
 in the questioner's message, please do not post unsensible stuff.

 Uwe Ligges


 Actually, I would have said that was quite an interesting solution.  If 
 the time is guaranteed to be in this 8 character format, then that 
 idea's quite easily implemented:

 # Returns true if time is between 18:00:00 and 23:59:59
 check_time - function(time_string) {
  if (nchar(time_string)!=8) stop (Incorrect format)
  time_string = 18:00:00  time_string = 23:59:59
 }


   check_time(19:59:00)
 [1] TRUE
   check_time(16:59:00)
 [1] FALSE
  
   check_time(18:00:00)
 [1] TRUE
   check_time(23:59:59)
 [1] TRUE
   check_time(24:00:00)
 [1] FALSE
  
   check_time(18:05)
 Error in check_time(18:05) : Incorrect format


 Perhaps there is an issue if the locale does not sort character-based 
 numbers in the same way as ASCII?  But Otherwise, I can't see why this 
 solution wouldn't do the job.
  
 A more robust solution solution would parse the strings (?strptime) and 
 then check their days/hours/mins/seconds (?DateTimeClasses).  But 
 perhaps the above is sufficient?
 
 Well, the interesting part of the original question that everynody seems 
 to omit now was the second part:
 
 if (time[j] is between 22:00:00 and 05:59:59)
 
 hence the answer is still not sufficient (even if the syntax error has 
 been corrected) - and hence I asked for the format the time is 
 originally in.
 
 Uwe Ligges
 
 
 
 
 Cheers,

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

Re: [R] need help to manipulate function and time interval

2007-08-12 Thread Uwe Ligges


Matthew Walker wrote:
 Uwe Ligges wrote:
 Henrique Dallazuanna wrote:
  
 Hi,

 Try whit:

 if(time[j] = 18:00:00   23:59:59)
 

 This code is obviously wrong and does not help for the next few lines 
 in the questioner's message, please do not post unsensible stuff.

 Uwe Ligges

   
 
 Actually, I would have said that was quite an interesting solution.  If 
 the time is guaranteed to be in this 8 character format, then that 
 idea's quite easily implemented:
 
 # Returns true if time is between 18:00:00 and 23:59:59
 check_time - function(time_string) {
  if (nchar(time_string)!=8) stop (Incorrect format)
  time_string = 18:00:00  time_string = 23:59:59
 }
 
 
   check_time(19:59:00)
 [1] TRUE
   check_time(16:59:00)
 [1] FALSE
  
   check_time(18:00:00)
 [1] TRUE
   check_time(23:59:59)
 [1] TRUE
   check_time(24:00:00)
 [1] FALSE
  
   check_time(18:05)
 Error in check_time(18:05) : Incorrect format
 
 
 Perhaps there is an issue if the locale does not sort character-based 
 numbers in the same way as ASCII?  But Otherwise, I can't see why this 
 solution wouldn't do the job.
 
 A more robust solution solution would parse the strings (?strptime) and 
 then check their days/hours/mins/seconds (?DateTimeClasses).  But 
 perhaps the above is sufficient?

Well, the interesting part of the original question that everynody seems 
to omit now was the second part:

if (time[j] is between 22:00:00 and 05:59:59)

hence the answer is still not sufficient (even if the syntax error has 
been corrected) - and hence I asked for the format the time is 
originally in.

Uwe Ligges




 Cheers,
 
 Matthew

__
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 ON R!!!!!!!!!!!1

2007-08-11 Thread Uwe Ligges
I think I asked you yesterday on the [EMAIL PROTECTED] account to read the 
posting guide *before* posting to R-help and I asked you not to 
SHOUT!!!

Uwe Ligges


lecastil wrote:
 Good day. I am employed at a public entity that handles million 
 information and records of several variables and distributed in several 
 topics. For the statistical analyses we use a statistical package, which 
 allows us to call directly of the database (ORACLE) the information and 
 to realize the statistical analysis. Everything is done in brief time.
 
 Nevertheless, we want to know if the statistical package R is capable of 
 doing the same thing that does the statistical package with which we 
 work, that is to say, is R capable of importing information of a 
 database of million records to maximum speed and later statistical 
 analysis allows to realize once imported the information?.
 
 I am grateful for prompt response to you since it is of supreme urgency 
 to know this information.
 
 Luis Eduardo Castillo Méndez.
 
 **
  
 
 
 Buen día. Trabajo en una entidad pública que maneja millones de datos y 
 registros de varias variables y distribuidos en varios tópicos. Para los 
 análisis estadísticos usamos un paquete estadístico, el cuál nos permite 
 llamar directamente de la base de datos (ORACLE) la información y 
 realizar el análisis estadístico. Todo se hace en tiempo breve.
 
 Sin embargo, queremos saber si el paquete estadístico R es capaz de 
 hacer lo mismo que hace el paquete estadístico con el que trabajamos, es 
 decir, R es capaz de importar datos de una base de datos de millones de 
 registros a velocidad máxima y después permita realizar análisis 
 estadístico una vez importado los datos? .
 
 Te agradezco pronta respuesta ya que es de suma urgencia saber este dato.
 
 Luis Eduardo Castillo Méndez.
 
 __
 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] LDA and RDA: different training errors

2007-08-11 Thread Uwe Ligges


dominic senn wrote:
 Hello
 
 I try to fit a LDA and RDA model to the same data, which has two classes.
 The problem now is that the training errors of the LDA model and the
 training error of the RDA model with alpha=0 are not the same. In my
 understanding this should be the case. Am I wrong? Can someone explain what
 the reason for this difference could be?


I assume lda from MASS?
If you are using rda() from package rda, I do not know, since the help 
page is not very specific in telling which parameter means what (but I 
guess one of them should be 1).

If you choose rda() from package klaR, the help page tells you that
gamma=0, lambda=1
should produce identical results to LDA. (lambda=1 means that the pooled 
covariance matrix is weighted with 1 while the specific covariance 
matrices are weigthed with 0.


Uwe Ligges


 Here my code:
 
 LDA model:
 ===
 % x is a dataframe
 tmp = lda(response ~ ., data=x)
 tmp.hat = predict(tmp)
 tab = table(x$response, tmp.hat$class)
 lda.training.err = 1 - sum(tab[row(tab)==col(tab)])/sum(tab)
 
 RDA model:
 ===
 % x is converted into a matrix without the response
 % variable. This matrix is then transposed
 tmp = rda(x, y, alpha=0, delta=0)
 rda.training.err =  tmp$error / dim(x)[2] 
 
 % The training error provided by rda.cv() is also different
 % from the training errors provided by lda() or rda()
 tmp.cv = rda.cv(tmp, x=x, y=y, nfold=10)
 tmp.cv$err / dim(x)[2] / 10
 
 
 Thanks a lot!
 
 __
 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] Help with cumsum function

2007-08-11 Thread Uwe Ligges


Hectorman Hectorman wrote:
 Hello!
 
 I have a question regarding the cumsum function that I do not know how to 
 solve. Would appreciate help from someone. I have imported data from a 
 txtfile with 2 columns. I am interested in the seconds column, which 
 contains numbers from i=0 to 40. I would like to count the number of 
 instances of the numbers 0 to 40 in the seconds column. My problem is that 
 if there are no observations of one number i in the second column cumsum 
 skips this in the output.
 
 Below is an example of the output of the argument  Y=cumsum(table(x[,2]))
   0   1   2   3   5 6   789  10  11  12  13  14  15  16  17  18  
 19   20   21   22   23   24
   3   5   6  10  13  14  16  18  21  25  27  30  32  35  38  40  42  54 105 
 233 306 341 383 417
 2526  27  28  2930   31   32  33  34   35   36   37  38   39   40
 441 468 487 502 518 532 542 546 552 564 566 574 578 584 591 594
 
 As you can see from the output there are no observations of i=4 in this 
 column. Are there any way I could return the following result instead
 0   1   2   3   45 6   78  and so on
 3   5  6  10  10 13   14  16  18
 
 When i=4 cumsum is the same as when i=3 (10)
 


Y - cumsum(table(factor(x[,2], levels=0:40)))

Uwe Ligges


 I would really appreciate if anyone could help me with this one:)
 
 Jan Moberg
 
 __
 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] Plot legend in margin

2007-08-10 Thread Uwe Ligges


Daniel Brewer wrote:
 Hi all,
 Another plotting question I am afraid.  Is there anyway of putting a
 legend for a plot in a margin rather than within the figure.  I am
 trying to plot a 3x2 plot and I want to have:
 1) One key along the bottom for all the plots
 2) A label (a,b,c) for each plot (see previous emails)
 
 Is there any websites etc. that explain this sort of thing?

Please read the posting guide.

After that, type:
   RSiteSearch(legend margin)

Currently, the fourth entry shows a solution:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67979.html

Uwe Ligges


 Dan


__
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] need help to manipulate function and time interval

2007-08-10 Thread Uwe Ligges


Henrique Dallazuanna wrote:
 Hi,
 
 Try whit:
 
 if(time[j] = 18:00:00   23:59:59)

This code is obviously wrong and does not help for the next few lines in 
the questioner's message, please do not post unsensible stuff.

Uwe Ligges


 ...
 ...
 
 
 
 
 
 __
 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] need help to manipulate function and time interval

2007-08-10 Thread Uwe Ligges


KOITA Lassana - STAC/ACE wrote:
 Hi R-users,
 
 I have to define a noise level function L and its energy in the various 
 moment of the day by:
 
  if time is between 18:00:00 and 23:59:59 then  L[j] - L[j]+5 and W - 
 10^((L+5)/10) 


What kind of object is time? Just a character or some Time/Date format?
Do you know the day?

If time is between 18:00:00 and 23:59:59, should the next point (time is 
between 22:00:00 and 05:59:59) be executed additionally if time is, 
e.g., 23:00:00 or is there any other condition I cannot see?

All the information is quite essential in order to help...

BTW: I don't think the rest of your code is sensible (at least, some 
braces are missing).

Uwe Ligges



 if time is between 22:00:00 and 05:59:59 == L - L+10  and W - 
 10^((L+10)/10)
 else
 L=L and W = W
 
 Could someone help me to realize this function please? You will find my 
 following proposal  code, but my main problem is to handle the time 
 interval.
 
 Best regard
 
 ###
 myfunc - function(mytab, Time, Level)
 {
 vect - rep(0, length(mytab))
 for(i in 1:length(vect))
{
   for(j in 1:length(Time))
 
 if(time[j] is between 18:00:00 and 23:59:59) 
 
 L[i] - L[j]+5 
  
vect[i] - 10^((L[i])/10
 
 if (time[j] is between 22:00:00 and 05:59:59)
 
 L[i] - L[j]+10 
  
  vect[i] - 10^((L[i])/10
 
 else 
  
L[i] = L[j]
  
   vect[i] - 10^((L[i])/10
  } 
 } 
 
 ###
 
 Lassana KOITA 
 Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique  / 
 Project Engineer Airport Safety Studies  Statistical analysis
 Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical 
 Department 
 Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation 
 Headquarters
 Tel: 01 49 56 80 60
 Fax: 01 49 56 82 14
 E-mail: [EMAIL PROTECTED]
 http://www.stac.aviation-civile.gouv.fr/
   [[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] help on getting weekday

2007-08-06 Thread Uwe Ligges


Baoqiang Cao wrote:
 Dear All,
 
 I'd like to know which weekday it is for any given date, such as, what is
 the weekday for 2006-06-01? Any help will be highly appreciated.

See ?weekdays

Uwe Ligges




 Best,
 Baoqiang
 
   [[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] plot to postscript orientation

2007-08-03 Thread Uwe Ligges


Miruna Petrescu-Prahova wrote:
  Hi
 
  I am trying to save some plots in a postscript file. When I generate the 
 plots in the main window, they appear correctly - their orientation is 
 landscape (i.e., horizontal). However, when I open the .ps file with GSview, 
 the whole page appears vertically, and the plot appears horizontally, which 
 means that the plot is only partially visible (example here 
 https://webfiles.uci.edu/mpetresc/postscript.files/default.ps ). I searched 
 the R-help mailing list archive and found 2 suggestions: setting the width 
 and height and setting horizontal = FALSE. I have tried setting the width 
 and height but it makes no difference. I have also tried using horizontal = 
 FALSE. This rotates and elongates the plot, but it is still displayed 
 horizontally on a vertical page, and so only partially  visible (example 
 here https://webfiles.uci.edu/mpetresc/postscript.files/horiz.false.ps). I 
 am not sure what is wrong. Plots are created with filled.contour.


I guess this is a misconfiguration of your GSview. The plots are fine 
for me. Anyway, you might also want to set the argument
paper=special in the postscript() call.

Uwe Ligges


  Thanks
  Miruna
 
 
 
 Miruna Petrescu-Prahova
 Department of Sociology
 University of California, Irvine
 [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-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with making dll under Windows

2007-08-03 Thread Uwe Ligges
Please check that you have installed a suitable environment (tools, 
compiler etc.) as mentioned in the R Installation and Administration 
manual. Öooks like your version of Perl is corrupted.

I got with your C program:

d:\aaaR CMD SHLIB dmypow.c
making dmypow.d from dmypow.c
gcc   -It:/R/include  -Wall -O3 -std=gnu99   -c dmypow.c -o dmypow.o
windres -I t:/R/include  -i dmypow_res.rc -o dmypow_res.o
gcc  -shared -s  -o dmypow.dll dmypow.def dmypow.o dmypow_res.o 
-Lt:/R/bin-lR


Uwe Ligges



Albrecht, Dr. Stefan (APEP) wrote:
 Dear all,
  
 I have problems to compile a DLL for Windows XP with R version 2.5.1 
 (2007-06-27).
 See output below:
  
 C:\AZ_DATEN\C, C++\BE_speedupR CMD SHLIB dmypow.c
 Goto undefined subroutine DynaLoader::bootstrap_inherit at 
 C:\Programme\R\R-2.5
 .1\share\perl/XSLoader.pm line 80.
 Compilation failed in require at c:/Programme/Perl/lib/IO/Handle.pm line 262.
 BEGIN failed--compilation aborted at c:/Programme/Perl/lib/IO/Handle.pm line 
 262
 .
 Compilation failed in require at c:/Programme/Perl/lib/IO/Seekable.pm line 
 101.
 BEGIN failed--compilation aborted at c:/Programme/Perl/lib/IO/Seekable.pm 
 line 1
 01.
 Compilation failed in require at c:/Programme/Perl/lib/IO/File.pm line 133.
 BEGIN failed--compilation aborted at c:/Programme/Perl/lib/IO/File.pm line 
 133.
 Compilation failed in require at 
 C:\Programme\R\R-2.5.1\share\perl/FileHandle.pm
  line 6.
 Compilation failed in require at C:\Programme\R\R-2.5.1\share\perl/R/Utils.pm 
 li
 ne 6.
 BEGIN failed--compilation aborted at 
 C:\Programme\R\R-2.5.1\share\perl/R/Utils.p
 m line 6.
 Compilation failed in require at C:\Programme\R\R-2.5.1/bin/SHLIB line 24.
 BEGIN failed--compilation aborted at C:\Programme\R\R-2.5.1/bin/SHLIB line 24.
  
 The file DynaLoader.pm is in the same directory as, e.g. XSLoader.pm
  
 The c-file itself is very simple:
 #include Rinternals.h
 #include math.h
  
 SEXP mypow(SEXP lifeFund, SEXP bow)
 {
  int i;
  double n;
  
  n = length(lifeFund);
  for (i=0; in; i++)
   REAL(lifeFund)[i] = pow((i+1)/n,REAL(bow)[0]);
  return(lifeFund);
 }
 
 Could anybody help, please?
  
 With many thanks and best regards,
 Stefan
  
 
 Dr. Stefan Albrecht, CFA
 Allianz Private Equity Partners GmbH
 Königinstr. 19 | 80539 Munich | Germany
 
 Phone: +49.(0)89.3800.18317
 Fax: +49.(0)89.3800.818317
 EMail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
 Web: www.apep.com http://www.apep.com/ 
 
 
 Allianz Private Equity Partners GmbH | Geschäftsführung: Wan Ching Ang, Karl 
 Ralf Jung
 Sitz der Gesellschaft: München | Registergericht: München HRB 126221 | 
 Ust-ID-Nr.: DE 813 264 786
 
 
 
   [[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.


[R] useR! 2008

2007-08-03 Thread Uwe Ligges
We are happy to announce that the R user conference

   useR! 2008

is scheduled for August 12-14, 2008, and will take place at the
University of Dortmund.

As for the predecessor conferences, the program will consist of two parts:
invited lectures and user-contributed sessions (abstract submission will
be available online starting from December 2007). Prior to the
conference, there will be tutorials on R (proposals for tutorials should
be sent before 2007-10-31).


INVITED LECTURES

Invited speakers will include

 Peter Bühlmann, John Fox, Kurt Hornik, Gary King, Duncan Murdoch,
 Jean Thioulouse, Graham J. Williams, and Keith Worsley.


USER-CONTRIBUTED SESSIONS

The sessions will be a platform to bring together R users, contributors,
package maintainers and developers in the S spirit that `users are
developers'. People from different fields will show us how they solve
problems with R in fascinating applications.
The sessions are organized by members of the program committee, including

 Micah Altman, Roger Bivand, Peter Dalgaard, Jan de Leeuw,
 Ramón Díaz-Uriarte, Spencer Graves, Leonhard Held, Torsten Hothorn,
 François Husson, Christian Kleiber, Friedrich Leisch, Andy Liaw,
 Martin Mächler, Kate Mullen, Ei-ji Nakama, Thomas Petzold,
 Martin Theus, and Heather Turner.

The program will cover topics such as

 * Applied Statistics  Biostatistics
 * Bayesian Statistics
 * Bioinformatics
 * Chemometrics and Computational Physics
 * Data Mining
 * Econometrics  Finance
 * Environmetrics  Ecological Modeling
 * High Performance Computing
 * Machine Learning
 * Marketing  Business Analytics
 * Psychometrics
 * Robust Statistics
 * Sensometrics
 * Spatial Statistics
 * Statistics in the Social and Political Sciences
 * Teaching
 * Visualization  Graphics
 * and many more.


PRE-CONFERENCE TUTORIALS

Before the official program, half-day tutorials will be offered
on Monday, August 11th.
We invite R users to submit proposals for three hour tutorials on
special topics on R. The proposals should give a brief description of
the tutorial, including goals, detailed outline, justification why the
tutorial is important, background knowledge required and potential
attendees. The proposals should be sent before 2007-10-31 to
[EMAIL PROTECTED]


A web page offering more information on the `useR!' conference is
available at

   http://www.R-project.org/useR-2008


ABOUT DORTMUND

In the past, Dortmund was famous for coal, steel and the beer industry -
quite typical for a city in the Ruhrgebiet. Today, Dortmund evolves to a
city with high tech industry, exhibitions and service companies.
Dortmund's football (i.e. soccer) club is world famous and attracts
roughly 8 people on a regular basis.


IMPORTANT DATES

 2007-10-31: submission deadline of tutorial proposals
 2007-12-01: start of registration
 2007-12-01: start of online abstract submission
 2008-03-31: early registration deadline:
 2008-03-31: submission deadline of abstracts
 2008-05-15: notification of acceptance
 2008-05-31: regular registration deadline
 2008-07-25: registration deadline


We hope to meet you in Dortmund!


The conference committee:
 Uwe Ligges (conference), Achim Zeileis (program), Claus Weihs,
 Gerd Kopp (local organization), Friedrich Leisch, Torsten Hothorn

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A combinatorial task. How to get rid of loops

2007-08-02 Thread Uwe Ligges


Serguei Kaniovski wrote:
 Dear List,
 
 I am looking for a faster way of accomplishing this:
 
 # n is an integer larger than two
 n - 3
 
 # matrix of 2^n binary outcomes
 bmat - as.matrix(expand.grid( rep( list(1:0), n))[, n:1])
 
 # I would like to know which rows of bmat have 1 in the i and j 
 coordinates, so for n=3 in coordinates 1-2, 1- 3, and 2-3
 # I would like then to construct choose( n, 2) binary vectors of lengths 
 2^n to indicate those rows with a 1
 # The loop below accomplishes this task. Is there a faster way of doing 
 the same?
 
 library(combinat)
 
 # matrix of all pairwise combinations 
 cmat-combn( n, 2)


One example is:

n - 3
bmat - as.matrix(expand.grid( rep( list(1:0), n))[, n:1])
library(combinat)
cmat-combn( n, 2)
apply(cmat, 2, function(x) as.numeric(bmat[,x[1]]  bmat[,x[2]]))

Uwe Ligges



 temp-matrix(NA, nrow(bmat), ncol(cmat))
 
 for (i in 1:nrow(bmat))
 {
 for (j in 1:ncol(cmat))
 {
 temp[ i, j]-as.numeric( bmat[i,][cmat[1,j]]  
 bmat[i,][cmat[2,j]] == 1)
 }
 }
 
 
 Thank you very much for your help!
 Serguei Kaniovski
 
 __
 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] warning messages in grid or lattice give that I can't debug

2007-08-02 Thread Uwe Ligges


Richard M. Heiberger wrote:
 The messages are visible in 2.6.0dev
 The same commands in 2.4.1 work without warning messages.
 I am using the HH_1.18-1 from R_2.4.1 with both R versions and not
 the current HH_2.1-3
 
 version$version.string
 installed.packages()[c(grid,lattice, HH),3]
 ## library(HH)
 library(lattice, lib.loc=C:/PROGRA~1/R/R-2.4.1/library)

It is essential not to use a lattice version designed for R-2.4.1 with 
R-devel... And I don't see a reason, and in some cases, switching to 
another major version of R requires recompiling of packages anyway.

Uwe Ligges





 hotdog - read.table(hh(datasets/hotdog.dat), header=TRUE)
 ancova(Sodium ~ Calories + Type, data=hotdog)
 
 
 the messages in R_2.6.0dev are
 Warning messages:
 1: In grid.Call.graphics(L_points, x$x, x$y, x$pch, x$size) :
   supplied color is not numeric nor character
 ...
 6: In grid.Call.graphics(L_points, x$x, x$y, x$pch, x$size) :
   supplied color is not numeric nor character
 
 
 My guess is that these warnings are a response to a change in grid or lattice
 in 2.5.0.  I attempted to trace these with 
 options(warn=2)
 options(error=recover)
 without success.
 
 Debugging suggestions or revised programming suggestions would be appreciated.
 
 Rich
 
 __
 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] passing args to R CMD BATCH in win 2000

2007-08-02 Thread Uwe Ligges


[EMAIL PROTECTED] wrote:
 Hello and sorry to bother.
 
 Please help.
 I searched the archives but could not find out why --args is being ignored 
 on Windows 2000.


That does not work with R CMD BATCH, AFAIK. In fact, you want to use:

Rterm --no-save --args 12  11.R  11.Rout

Uwe Ligges



 I try
 
 R CMD BATCH --slave 11.R 11.Rout --args 12
 
 and 11.R has
 
 x=commandArgs(trail=T)
 print(x)
 a=x[length(x)]
 write.csv(a,file=13.out)
 q(no)
 
 
 the argument is not passed to the R process.
 11.Rout only shows processing time and 13.out does not have the value.
 
 
 Thank you all.
 stephen
   [[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] beamer error with R

2007-08-02 Thread Uwe Ligges


Mario Alfonso Morales Rivera wrote:
 Dear R users,
 
 When I use beamer with \usepackage{harvard} it don't work.


Why is this related to R? I do not see any connections here.

Uwe Ligges



 \LaTeX{} give mi an error message, ¿any suggestion?
 
 ! LaTeX Error: No counter 'paragraph' defined.
 
 See the LaTeX manual or LaTeX Companion for explanation. Type  H
 return  for immediate help.
  ...
 
 l.741 \newcounter{lsubparagraph}[paragraph]
 
 ? ! Emergency stop.
  ...
 
 l.741 \newcounter{lsubparagraph}[paragraph]
 
 Your command was ignored. Type  I command return  to replace it
 with another command, or  return  to continue without it.
 
 
 ! LaTeX Error: No counter 'paragraph' defined.
 
 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H return  for immediate help.
  ... 
  
 l.741 \newcounter{lsubparagraph}[paragraph]
   
 ?
 ! Emergency stop.
  ... 
  
 l.741 \newcounter{lsubparagraph}[paragraph]


__
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] Re : beamer error with R

2007-08-02 Thread Uwe Ligges


justin bem wrote:
 Is it possible to realise slides with R ? 


If you want to combine LaTeX and R code, take a look at SWeave.

Uwe Ligges


 Justin BEM
 BP 1917 Yaoundé
 Tél (237) 99597295
 (237) 22040246
 
 - Message d'origine 
 De : Uwe Ligges [EMAIL PROTECTED]
 À : Mario Alfonso Morales Rivera [EMAIL PROTECTED]
 Cc : [EMAIL PROTECTED]
 Envoyé le : Jeudi, 2 Août 2007, 14h26mn 56s
 Objet : Re: [R] beamer error with R
 
 
 
 Mario Alfonso Morales Rivera wrote:
 Dear R users,

 When I use beamer with \usepackage{harvard} it don't work.
 
 
 Why is this related to R? I do not see any connections here.
 
 Uwe Ligges
 
 
 
 \LaTeX{} give mi an error message, ¿any suggestion?

 ! LaTeX Error: No counter 'paragraph' defined.

 See the LaTeX manual or LaTeX Companion for explanation. Type  H
 return  for immediate help.
  ...

 l.741 \newcounter{lsubparagraph}[paragraph]

 ? ! Emergency stop.
  ...

 l.741 \newcounter{lsubparagraph}[paragraph]

 Your command was ignored. Type  I command return  to replace it
 with another command, or  return  to continue without it.


 ! LaTeX Error: No counter 'paragraph' defined.

 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H return  for immediate help.
  ... 
  
 l.741 \newcounter{lsubparagraph}[paragraph]
   
 ?
 ! Emergency stop.
  ... 
  
 l.741 \newcounter{lsubparagraph}[paragraph]

 
 __
 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.
 
 
 
 
 
 
 
   
 _ 
 
 l 
   [[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] R2WinBUGS more updates after model did not converge

2007-07-31 Thread Uwe Ligges


[EMAIL PROTECTED] wrote:
 After running a model for a while and seeing that it did not converge yet, 
 how 
 can I continue to run, ie not starting anew, the model?
 
 I know if I manually/interactively use winbugs, this is possible anytime, but 
 how can I do this in r2winbugs, so that my existing sim$sims.array and other 
 stuff in the object that bugs() returns gets extended?


This is not possible with R2WinBUGS. But you can use BRugs, which is 
much more flexible, has an improved interface and uses OpenBUGS.
It's CRAN version is based on OpenBUGS 2.x.y, but we (i.e. currently 
mainly Insightful people and myself) are on the way to release a new 
version based on OpenBUGS 3.x.y.

Uwe Ligges




 Thanks Toby
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A simple question about summary.glm

2007-07-31 Thread Uwe Ligges


michal33 wrote:
 Hello,
 
 I am new to R and have tried to search similar questions but could not find
 exactly what I am looking for, but I apologize if the question was already
 asked.
 
 I have 10 different treatments and want to know whether they affect the sex
 ratios of insect emergence. After running the glms I got this table:
 
   Df Deviance Resid. Df Resid. Dev  F   Pr(F)   
 NULL133 9250.3   
 sex1481.5   132 8768.9 7.7212 0.006314 **
 trt9   1099.1   123 7669.7 1.9585 0.049780 * 
 
 But now I would like to know WHICH of the treatments was significant. I
 tried to use Tukey test but for some reason it does not work. 
 My question is:
 I used the following function: 
 summary(file.name, corr=F)
 and got the following table:
 Deviance Residuals: 
 Min   1Q   Median   3Q  Max  
 -14.118   -4.808   -1.4662.033   33.882  
 Coefficients:
   Estimate Std. Error   t value Pr(|t|)
 (Intercept)  8.696e+00  1.893e+00 4.594 1.06e-05 ***
 sexm-3.791e+00  1.364e+00-2.779  0.00631 ** 
 trtccc  -1.050e+00  4.325e+00-0.243  0.80859
 trtcga3  2.450e+00  4.325e+00 0.566  0.57211
 trtcga4 -2.300e+00  4.325e+00-0.532  0.59584
 trtg 1.550e+00  2.497e+00 0.621  0.53593
 trtga4  -5.550e+00  4.325e+00-1.283  0.20183
 trtp 5.422e+00  2.566e+00 2.113  0.03658 *  
 trtpg   -1.850e+00  2.497e+00-0.741  0.46019
 trtw-3.634e-17  2.497e+00 -1.46e-17  1.0
 trtwg   -3.750e+00  2.497e+00-1.502  0.13573
 
 What do the stars  mean?


Well, you omitted the last lines from the output which include:

Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


i.e. *** for values  0.001; * for values in [0.01, 0.05) etc.

Uwe Ligges



  Is it the same as Tukey test that tells me which
 treatment is different from which? i.e. is trtp (with *) significantly
 different to the control (which, by the way do not appear in this list and I
 do not know why)? 
 
 Thanks
 Michal
 


__
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] 'non-standard' folder names in R package

2007-07-31 Thread Uwe Ligges


Tao Shi wrote:
 Hi list,
 
 I use a .xml file for a function's demo in the R package I'm creating.  
 Since it doesn't belong to any of the 'standard' folders, i.e. those 
 mentioned in the 'Writing R Extension', I put it in a folder call 
 myXML, much like the 'iris.xl' file in 'xls' folder from 'gdata' 
 package, for example.  After running R CMD build, I could see the .xml 
 file is in the ..tar.gz file.  However, after running R CMD INSTALL 
 -build, the file and the folder disappeared in both the .zip file and 
 the installed package.  (R CMD CHECK, of course, failed too before that, 
 as myXML can't be installed.)  Could anybody tell me what's the tricks 
 to keep those folders in my installation?  I'm using R-2.5.1 under WinXP.
 
 Thank you very much!



If you want it to be in mypackage/myXML after installation, put it into 
mypackage/inst/myXML in the source package, as the manual you cited 
suggests.

Uwe Ligges




 Tao
 
 _
 Need a brain boost? Recharge with a stimulating game. Play now! 
 
 
 
 
 __
 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] Getting variable name used in function...

2007-07-31 Thread Uwe Ligges


Levent TERLEMEZ wrote:
 Dear Users,
 I am using functions for calculations in my study. I have two functions 
 and one is calling the other two times one after another. But the called 
 function deals with two different data object (matrix, data frame, etc.), so 
 I could not make the second function output  data object-free (for example, Ý 
 would like to write csv files but could not give different file names) and I 
 would like to get object name. Is it possible to get data object's name. And 
 if it is possible, how can I assign this name as an new data object name with 
 an extra addition, for example, data objects name+2.
 
 Thanks for your help.
 
 Example:
 function1(var1,var2)
 function2(var1)
 function2(var2)
 ...


Can you explain what you want in an example, please? I do not really 
undertsand what you are trying to do.

Uwe Ligges



 With my best regards,
 Levent TERLEMEZ.
 
   [[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] Problem with code

2007-07-31 Thread Uwe Ligges


Shawndelle Noble wrote:
 Hi I am having the following Warning message with this code:
 
 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file- reason 'No such file or directory' in: file(file, r)
 
 The files are present on a CD and USB key- I tried opening all the
 files-then running the script but, it makes no difference.

Then you are trying to open non-existing files or your mistyped the 
filenames. Simply check the filenames again.


 Basically
 How do I ensure that R reads my files to perform functions- I have some
 files on CD and other on my a USB key.

By specifying the correct names.


 Also if I am using script that was already written, for new data - how do I
 know which info. in the existing script should be updated?

If the script (= function ?) is well written, you just have to give 
the filenames as arguments to the functions. If not, you have to look 
into the sources and generalize ...

Uwe Ligges



 Thanks
 faith1
 
   [[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] deriv; loop

2007-07-31 Thread Uwe Ligges
francogrex wrote:
 Hi, 2 questions:
 
 Question 1: example of what I currently do:
 
 for(i in 1:6){sink(temp.txt,append=TRUE)
 dput(i+0)
 sink()}
 x=scan(file=temp.txt)
 print(prod(x))
 file.remove(C:/R-2.5.0/temp.txt)
 
 But how to convert the output of the loop to a vector that I can manipulate
 (by prod or sum etc), without having to write and append to a file?


So, do you want the file at the end or not? If not:

x - 1:6
prod(x)

and if this is really the solution you want, the please read the posting 
guide and the manuals before posting again.




 Question 2:
 
 deriv(~gamma(x),x)
 
 expression({
 .expr1 - gamma(x)
 .value - .expr1
 .grad - array(0, c(length(.value), 1), list(NULL, c(x)))
 .grad[, x] - .expr1 * psigamma(x)
 attr(.value, gradient) - .grad
 .value
 })
 
 BUT
 
 deriv3(~gamma(x),x)
 Error in deriv3.formula(~gamma(x), x) : Function 'psigamma' is not in the
 derivatives table
 
 What I want is the expression for the second derivative (which I believe is
 trigamma(x), or psigamma(x,1)), how can I obtain that?


By using some algebraic software (rather than a numeric one) or 
contributing complete derivatives tables for the next R release.

Uwe Ligges

__
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] Fwd: Package manual examples - 'unexpected$undefined' errors

2007-07-31 Thread Uwe Ligges
David Pain wrote:
 Bounced first time!
 
 -- Forwarded message --
 From: David Pain [EMAIL PROTECTED]
 Date: 28-Jul-2007 11:03
 Subject: Package manual examples - 'unexpected$undefined' errors
 To: r-help@stat.math.ethz.ch
 
 
 Trying out an unfamiliar package, the natural thing is to use the
 examples given in the package's manual - hopefully, the writers of the
 package wouldn't include examples which didn't work!
 
 Recently, though, I've been getting 'unexpected$undefined' error
 messages when doing this, despite having copy/pasted the text from the
 manual (taking out hard breaks on the way).

Well, we cannot know if the package does make problems (you haven't 
stated which one).


 Moreover, I've had error messages for commands which I've previously
 had work fine.
 
 For instance, this from Zelig
 
 z.out ­ zelig(vote ~ race + educate, model = logit, data = turnout)
 
 has at different times worked fine and thrown up the error message.

So you tell us the some package influences Zelig's functionality, but 
how can we help if you do not tell us which one it is?

Uwe Ligges


 Any help gratefully received.
 
 __
 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] line widths of plotting symbols in the lattice

2007-07-31 Thread Uwe Ligges


Stephen Tucker wrote:
 Dear List,
 
 Sorry, this is very simple but I can't seem to find any information regarding
 line widths of plotting symbols in the lattice package.
 
 For instance, in traditional graphics:
 
 plot(1:10,lwd=3)
 points(10:1,lwd=2,col=3)
 
 'lwd' allows control of plotting symbol line widths.


'lwd' is documented in ?gpar (the help page does not show up for me, 
I'll take a closer look why) and works for me:

xyplot(1:10 ~ 1:10, type = l, lwd = 5)


Uwe Ligges



 I've tried looking through the documentation for xyplot, panel.points,
 trellis.par.set, and the R-help archives. Maybe it goes by another name?
 
 Thanks in advance,
 
 Stephen
 
 __
 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] Plotting a smooth curve from predict

2007-07-31 Thread Uwe Ligges


Wilson, Andrew wrote:
 Probably a very simple query:
 
 When I try to plot a curve from a fitted polynomial, it comes out rather
 jagged, not smooth like fitted curves in other stats software.  Is there
 a way of getting a smooth curve in R?
 
 What I'm doing at the moment (for the sake of example) is:
 
 x - c(1,2,3,4,5,6,7,8,9,10)
 
 y - c(10,9,8,7,6,6.5,7,8,9,10)
 
 b - data.frame(cbind(x,y))
 
 w - gls(y ~ I(x)+I(x^2),correlation=corARMA(p=1),method=ML,data=b)
 
 plot(predict(w),type=l)


predict() predicts at all locations in x and you are drawing straight 
lines between these points.
Hence you need to predict in another resolution, e.g.:

  dat - data.frame(x = seq(1, 10, by = 0.1))
  plot(predict(w, newdata = dat), type=l)

Uwe Ligges


 Many thanks,
 
 Andrew Wilson
 
 __
 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] Creating windows binary R package (PowerArchiver vs. zip -r9X)

2007-07-27 Thread Uwe Ligges


Tao Shi wrote:
 Hi list,I apologize if you see funny fonts, b/c I'm using the new
 Windows Live Hotmail and don't know how to turn off the rich text
 mode.I have successfully built and installed a R package in
 windowsXP for R-2.5.1.  But when I tried to create a .zip file so I
 can use Packages/install package(s) from local .zip files... to
 install it, it seems R only recognizes the .zip file created by zip
 -r9X not by PowerArchiver.  Do you know why?  I vaguely remember I
 used WinZip before and it worked fine.The two threads I found on
 R-help and R-devel help me a lot, but don't really answer my
 question.http://tolstoy.newcastle.edu.au/R/help/06/06/29587.htmlhttp://tolstoy.newcastle.edu.au/R/devel/05/12/3336.htmlThanks,...Tao


In order to provide a Windows binary package, type:

R CMD INSTALL --build PackageName_vers.tar.gz
and the zip file will be generated by R in the correct way.

Uwe Ligges

__
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] qda(MASS) function error

2007-07-26 Thread Uwe Ligges


Mauro Rossi wrote:
 Dear R user,
  I'm using qda (quadratic discriminant analysis) function (package MASS) 
 to classify 58 explanatory variables (numeric type with different 
 ranges) using a grouping variable (factor 2 levels 0 1). I'm using 
 the qda method for class 'data.frame' (in this way I don't need to 
 specify a formula).
 Using the function:
 result.qda-qda(explanatory.variables, grouping.variable, method=moment)
 I obtain the following error message:
 Error in qda.default(x, grouping, ...) : rank deficiency in group 0
 I run the script excluding some variables and I've individuated 2 
 explanatory variables that give problems, but  I don't understand why 
 they give them. The two excluded variables are numeric with two possible 
 values: 0 and 1, but in the rest of group of  variables, some similar 
 variables are considered.
 
 I don't have this problem using lda  function for linear discriminant 
 analysis.
 
 What does this error message mean?
 What types of variables does qda function consider?

Well, qda assumes real values (and not factors) in the explanatory 
variables. If you think it makes sense to ignore this assumption (and I 
doubt it makes sense), then the error message tells you there is a rank 
deficiency, i.e. some variables might be collinear.
Hence at least one of the covariance matrices cannot be inverted.

Uwe Ligges


 Thank in advance,
 Mauro Rossi
 
 
 
 
 __
 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] error in using R2WinBUGS on Ubuntu 6.10 Linux

2007-07-26 Thread Uwe Ligges


[EMAIL PROTECTED] wrote:
 I am trying to run WinBUGS 1.4 from the Ubuntu 6.10 Linux distribution. I am 
 using the R2WinBUGS packages with the  source file listed below. WinBUGS 
 appears to run properly, but I get the following message after WinBUGS starts 
 in WINE. Does anyone know what may be causing this error and what the 
 correction may be?
 
 Thanks
 
 ERROR MESSAGE:
 
 fixme:ole:GetHGlobalFromILockBytes cbSize is 13824
 err:ole:CoGetClassObject class {0003000a---c000-0046} not 
 registered
 err:ole:CoGetClassObject class {0003000a---c000-0046} not 
 registered
 err:ole:CoGetClassObject no class object 
 {0003000a---c000-0046} could be created for context 0x3
 fixme:keyboard:RegisterHotKey (0x10032,13,0x0002,3): stub
 fixme:ntdll:RtlNtStatusToDosErrorNoTeb no mapping for 800a
 err:ole:local_server_thread Failure during ConnectNamedPipe 317


This is wine, not R2WinBUGS nor WinBUGS nor R, I fear, and the fixme: 
sounds promising that things go away in a more recent version of wine...

Uwe Ligges

 
 
 R SOURCE FILE:
 
 rm(list=ls(all=TRUE))
 
 library(R2WinBUGS)
 
 inits-function(){
   list(alpha0 = 0, alpha1 = 0, alpha2 = 0, alpha12 = 0, sigma = 1)
 }
 
 data-list(r = c(10, 23, 23, 26, 17, 5, 53, 55, 32, 46, 10,   8, 10,   8, 23, 
 0,  3, 22, 15, 32, 3),
 n = c(39, 62, 81, 51, 39, 6, 74, 72, 51, 79, 13, 16, 30, 28, 45, 4, 12, 41, 
 30, 51, 7),
 x1 = c(0,   0,  0,   0,   0, 0,   0,   0,  0,   0,   0,  1,   1,   1,   1, 1, 
   1,  1,   1,   1, 1),
 x2 = c(0,   0,  0,   0,   0, 1,   1,   1,  1,   1,   1,  0,   0,   0,   0, 0, 
   1,  1,   1,   1, 1),
 N = 21)
 
 test-bugs(data,inits,
 
 model.file=/home/meyerjp/rasch/test.bug,
 
 parameters=c(alpha0,alpha1,alpha12,alpha2,sigma),
 
 n.chains=2,n.iter=1,n.burnin=1000,
 
 bugs.directory=/home/meyerjp/.wine/drive_c/Program Files/WinBUGS14/,
 working.directory=/home/meyerjp/rasch/working,
 
 debug=FALSE,
 WINEPATH=/usr/bin/winepath,
 newWINE=TRUE)
 
 __
 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 and mysql

2007-07-23 Thread Uwe Ligges


Gabor Grothendieck wrote:
 To run with R 2.5.1 you need the Windows binary of RMySQL 0.6-0 but
 I don't think that that is available on either CRAN or BioConductor currently.

But on the CRAN extras repository which is provided by Brian Ripley. 
You can even select it from the menu (and it should be the default).
Hence install.packages(RMySQL) shoudl work.

Uwe Ligges



 however, one does exist and I suggest you contact the
 maintainer, David James or the r-sig-db list.  If those don't get it for you
 send me an email off list and I will send you mine.
 
 I have only used the Windows version on XP so I can't say whether there
 would be any problems on W2k.
 
 On 7/22/07, along zeng [EMAIL PROTECTED] wrote:
 Hi all,
 I want to visit MySQL in R use RMySQL package on Windows 2k.I got
 RMySQL and DBI packages from a cran,but only the package  RMySQL  is
 built on MasOS.I extracted both and put them under the folder of
 library,started R and typed string as ,
 require(RMySQL);
 R told me DBI was loaded,but RMySQL  was't loaded because R not found it.


 Thank very much!
  along

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


Re: [R] R2WinBUGS awkward to use

2007-07-23 Thread Uwe Ligges


[EMAIL PROTECTED] wrote:
 Hi All
 
 Does anyone know if I can avoid to use the write.model() function below? I 
 dont 
 want to do this. Can't bugs() do that automatically for me just by specifying 
 the 4th argument 'model'? Just I like I am also using the 'inits' object!
 
 If I use 'model' in the same way as I use 'inits' I am getting the error:
 
   sim - bugs(data, inits, parameters, model, n.chains=1, n.iter=5000, 
 bugs.directory=c:/Program Files/WinBUGS14, working.directory=NULL, 
 clearWD=TRUE, DIC=0)
 Error in file.exists(c(...)) : invalid 'file' argument


The idea is that people in general write their model files more or less 
while interactively using WinBUGS / OpenBUGS and later on start 
automizing with R2WinBUGS or BRugs. Then the file already exists.
Of course, we can add dome fancy stuff that applies write.model if an 
expression is given in the argument model.

I'll put it on the ToDo list.

Best,
Uwe Ligges


 
 Thanks Toby
 
 
 
 
 
 
 
 data - list(.)
 
 
 
 model - function() {
 
 [omitted]
 
 }
 
 write.model(model, cwk.txt)
 
 inits - function() {.}
 
 parameters - c(b, nu, S1, S2)
 
 sim - bugs(data, inits, parameters, cwk.txt, n.chains=1, n.iter=5000, 
 bugs.directory=c:/Program Files/WinBUGS14, working.directory=NULL, 
 clearWD=TRUE, DIC=0)
 
 print(sim)
 plot(sim)
 
 __
 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] how to determine/assign a numeric vector to Y in the cor.test function for spearman's correlations?

2007-07-20 Thread Uwe Ligges


G. wrote:
 Hello to all of you, R-expeRts!
 I am trying to compute the cor.test for a matrix that i labelled mydata
 according to mydata=read.csv...
 then I converted my csv file into a matrix with the 
 mydata=as.matrix(mydata)
 NOW, I need to get the p-values from the correlations...
 I can successfully get the spearman's correlation matrix with:
 cor(mydata, method=s, use=pairwise,complete,obs)
 but then if I try the 
 cor.test(mydata, method=s, use=pairwise.complete.obs)
 i always get an error message as follows:
 the y argument is missing and does not have any default value assigned... 
 (excuse my translation)
 WHAT SHOULD I DO???
 HOW CAN I DEFINE Y AS A NUMERIC VECTOR???
 thanx guys, i just can't express myself as a computer would...
 G :)


You have to specify two vectors for the test, e.g.:

   cor.test(mydata[,1], mydata[,2], method = s,
 use = pairwise.complete.obs)

See the help page ?cor.test

Best,
Uwe

__
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] Can I test if there are statistical significance between different rows in R*C table?

2007-07-20 Thread Uwe Ligges


zhijie zhang wrote:
 Dear  friends,
   My R*C table is as follow:
 
 
 
 better
 
 good
 
 bad
 
 Goup1
 
 16
 
 71
 
 37
 
 Group2
 
 0
 
 4
 
 61
 
 Group3
 
 1
 
 6
 
 57
 
Can I test if there are statistical significant between Group1 and
 Group2, Group2 and Group3, Group1 and Group2, taking into the multiple
 comparisons?


So what is you hypothesis? Statistical significance of what it to be tested?

Uwe Ligges



 The table can be set up using the following program:
 
 a-matrix(data=c(16,71,37,0,4,61,1,6,57),nrow=3,byrow=TRUE)
 Thanks very much.
 


__
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] plot centered line on barplot

2007-07-20 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:
 Dear R user,
 
 I need plot an histogram for the occurrence of a dataset, and then add a line 
 corresponding to the freuqnecy of another similar dataset. in order to do 
 this i used the function 
 hist_data1=hist(data1, breaks= seq(0,50,5), plot=FALSE)
 hist_data2=hist(data2, breaks= seq(0,50,5), plot=FALSE)
 
 then I plotted the frequency
 
 barplot(hist_data1$density)
 lines(hist_data1$density)


barplot() returns the positions on x-axis (these may be non-integers) 
where it draws the plots, hence you can say:

  bp - barplot(hist_data1$density)
  lines(bp, hist_data1$density)


 but the line is shifted in respect to the center of the bars. how can I 
 properly plot the line? another question. this is easy, how can I smooth the 
 curve (not fit with loess of spline)?

If you do not tell us which kind of smoother you prefer 

Uwe Ligges



 
 tnx
 
 --
 Claudio
 __
 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] Strange warning in summary.lm

2007-07-19 Thread Uwe Ligges


ONKELINX, Thierry wrote:
 Dear useRs,
 
 Lately I noticed a strange warning in the summary of a lm-object. Any
 idea what this warning is about? I'm using R 2.5.1 on Win XP pro.
 
 x - rnorm(100)
 y - rnorm(100)
 summary(lm(y~x))
 
 Call:
 lm(formula = y ~ x)
 
 Residuals:
  Min   1Q   Median   3Q  Max 
 -1,77809 -0,68438 -0,04409  0,63891  2,30863 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept) -0,002170,09244  -0,0230,981
 x0,013150,09628   0,1370,892
 
 Residual standard error: 0,9236 on 98 degrees of freedom
 Multiple R-Squared: 0.0001903,  Adjusted R-squared: -0.01001 
 F-statistic: 0.01866 on 1 and 98 DF,  p-value: 0,8916 
 
 Warning message:
 NAs introduced by coercion in: as.double.default(Cf[okP]) 

Probably you have an object in your workspace or another attached 
environment in the search path that conflicts with objects that are 
required to call summary(lm(...)). E.g. some lm... oder summary... function?

Best,
Uwe Ligges



   
 Thanks,
 
 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
 
 __
 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] Strange warning in summary.lm

2007-07-19 Thread Uwe Ligges
Ah, in  printCoefmat() there is Cf which is at some point:

Cf

 Estimate  Std. Error t value  Pr(|t|)
(Intercept)  0,2542  0,1875   1,356 
x   -0,5346  0,3463  -1,544 

and

cat(Cf)
0,2542 -0,5346  0,1875  0,3463  1,356 -1,544

(i.e. values are character) and then
x0 - (xm[okP] == 0) != (as.numeric(Cf[okP]) == 0)
includes as.numeric(Cf[okP]) which won't work any more.



I think this design is not the best possible. Nevertheless, the real 
problem is in format(), because it does not use its default 
`decimal.mark = .' if options(OutDec = ,) has been set, and even 
ignores manual chosen values:


# nice:
  options(OutDec = .)
  format(0.1, decimal.mark = :) #  [1] 0:1

# bug:
  options(OutDec = ,)
  format(0.1, decimal.mark = :) #  [1] 0,1

Best,
Uwe







ONKELINX, Thierry wrote:
 Dear Peter,
 
 Here's an example. Notice the warning in the last two lines of the summary 
 with options(OutDec = ,). It's not present with options(OutDec = .).
 
 Cheers,
 
 Thierry
 
 x - runif(100)
 y - rnorm(100)
 options(OutDec = ,)
 summary(lm(y~x))
 
 Call:
 lm(formula = y ~ x)
 
 Residuals:
   Min1QMedian3Q   Max 
 -2,389749 -0,607002  0,006969  0,689535  1,713197 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)  0,033970,17774   0,1910,849
 x   -0,092190,29518  -0,3120,755
 
 Residual standard error: 0,868 on 98 degrees of freedom
 Multiple R-Squared: 0.0009943,  Adjusted R-squared: -0.0092 
 F-statistic: 0.09754 on 1 and 98 DF,  p-value: 0,7555 
 
 Warning message:
 NAs introduced by coercion in: as.double.default(Cf[okP]) 
 options(OutDec = .)
 summary(lm(y~x))
 
 Call:
 lm(formula = y ~ x)
 
 Residuals:
   Min1QMedian3Q   Max 
 -2.389749 -0.607002  0.006969  0.689535  1.713197 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)  0.033970.17774   0.1910.849
 x   -0.092190.29518  -0.3120.755
 
 Residual standard error: 0.868 on 98 degrees of freedom
 Multiple R-Squared: 0.0009943,  Adjusted R-squared: -0.0092 
 F-statistic: 0.09754 on 1 and 98 DF,  p-value: 0.7555 
 
 
 
 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: Peter Dalgaard [mailto:[EMAIL PROTECTED] 
 Verzonden: donderdag 19 juli 2007 13:37
 Aan: ONKELINX, Thierry
 CC: Uwe Ligges; r-help@stat.math.ethz.ch
 Onderwerp: Re: [R] Strange warning in summary.lm

 ONKELINX, Thierry wrote:
 The problem also exists in a clean workspace. But I've found the 
 troublemaker. I had set options(OutDec = ,). Resetting this to 
 options(OutDec = .) solved the problem.

 Thanks,

 Thierry
   
 Oups. That sounds like there's a bug somewhere. Can you cook 
 up a minimal example which shows the behaviour?

 -- 
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  
 (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: 
 (+45) 35327907



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

2007-07-19 Thread Uwe Ligges


CG Pettersson wrote:
 Dear all!
 
 W2k, R 2.5.1
 
 I am working with an ongoing malting barley variety evaluation within
 Sweden. The structure is 25 cultivars tested each year at four sites, in
 field trials with three replicates and 'lattice' structure (the replicates
 are divided into five sub blocks in a structured way). As we are normally
 keeping around 15 varieties from each year to the next, and take in 10 new
 for next year, we have tested totally 72 different varieties during five
 years.
 
 I store the data in a field trial database, and generate text tables with
 the subset of data I want and import the frame to R. I take in all
 cultivars in R and use 'subset' to select what I want to look at. Using
 lme{nlme} works with no problems to get mean results over the years, but
 as I now have a number of years I want to analyse the general site x
 cultivar relation. I am testing AMMI{agricolae} for this and it seems to
 work except for the subsetting. This is what happens:
 
 If I do the subsetting like this:
 
 x62_samvar - subset(x62_5, cn %in%
 c(Astoria,Barke,Christina,Makof, Prestige,Publican,Quench))
 
 A test run with AMMI seems to work in the first part:
 
 AMMI(site, cn, rep, yield)
 
 ANALYSIS AMMI:  yield
 Class level information
 
 ENV:  Hag Klb Bjt Ska
 GEN:  Astoria Prestige Makof Christina Publican Quench
 REP:  1 2 3
 
 Number of observations:  240
 
 model Y: yield  ~ ENV + REP%in%ENV + GEN + ENV:GEN
 
 Analysis of Variance Table
 
 Response: Y
DfSum Sq   Mean Sq F valuePr(F)
 ENV 3 120092418  40030806 90.0424 1.665e-06 ***
 REP(ENV)8   3556620444578  0.5674  0.803923
 GEN 5  21376142   4275228  5.4564 9.680e-05 ***
 ENV:GEN15  28799807   1919987  2.4504  0.002555 **
 Residuals 208 162973213783525
 ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
 
 Coeff var   Mean yield
 13.08629 6764.098
 
 After this something goes wrong, as AMMI finds a cultivar name not
 selected in the subsetting. (The plotting might go wrong anyhow, but I
 haven´t got that far yet):
 
 Error in model.frame.default(Terms, newdata, na.action = na.action, xlev =
 object$xlevels) :
 factor 'y' has new level(s) Arkadia
 
 
 Looking at the dataframe using
 
 edit(x62_samvar)
 
 only shows the selected lines, but using levels() gives another answer as
 
 levels(x62_samvar$cn)
 
 gives back all 72 cultivar names used during the five years (starting with
 Arcadia).
 
 Where do I go wrong and how do I use subset in a proper way?


So you have to drop the levels you are excluding. Example:

   x - factor(letters[1:4])
   x
   x[1:2]
   x[1:2, drop=TRUE]


Uwe Ligges




 Thanks
 /CG


__
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] Error: evaluation nested too deeply when doing heatmap with binary distfunction

2007-07-19 Thread Uwe Ligges


zhihua li wrote:
 Hi netters,
 
 I have a matrix X of the size (1000,100). The values are from -3 to +3.  
 When I tried
 
 heatmap(X, 
 distfun=function(c),dist(c,method=bin),hclustfun=function(m),hclust(m,method=average))
  
 
 
 
 I got the error message: Error: evaluation nested too deeply: infinite 
 recursion / options(expressions=)?



So, does it help to increase the thresholds?
If not, please specify a easily reproducible example that helps us to 
investigate your problem.

Best,
Uwe Ligges




 However, if I used default parameters for distfunction:
 heatmap(X, hclustfun=function(m),hclust(m,method=average))
 there is no error messages at all.
 
 But the problem is that I have to use binary method in my disfunction. 
 How can I resolve the problem?
 
 Thanks a lot!
 
 
 
 
 __
 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] df manipulation

2007-07-19 Thread Uwe Ligges


Nikola Markov wrote:
 I have multicolumn data.frames with the first comumn giving ordinal 
 observation index ( ex.: 1 4 7 9 11 13 etc). I would like to fill up the 
 missing observations (i.e. 2 3 5 6 8 etc) with NAs.

Please specify reproducible examples, they make it much easier to help!


If you have:

df - data.frame(index = c(1, 4, 7), x1 = 1:3, x2 = 3:1)
df

Then you can say:

temp - data.frame(index = 1:max(df$index))
df - merge(temp, df, all.x = TRUE)
df

Uwe Ligges





 Thank you

 __
 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] filter out observation by condition

2007-07-18 Thread Uwe Ligges


sigalit mangut-leiba wrote:
 hello,
 I have a longitudinal data:
 idn mort30  newinfec
 1   0   1
 1   0   1
 1   0   1
 1   0   1
 2   1   1
 2   1   1
 2   1   1
 3   0   0
 3   0   0
 3   0   0
 3   0   0
 3   0   0
 
 and i want to filter out those obs. that has mort30==1 (mort30 is constant
 over idn).
 how can i use if...else and filter out those unwanted obs.?
 I appriciate the help,
 sigalit.


subset(data, mort30 != 1)

Uwe Ligges



   [[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] HELP FOR BUGS

2007-07-14 Thread Uwe Ligges


Ali raza wrote:
 Hi Sir
 
 I am very new user of R for the research project on multilevel
 logistic regression. There is confusion about bugs() function in R

Do you mean bugs() from package R2WinBUGS?
Yes, it is related to the software WinBUGS 1.4.x (and OpenBUGS 2.x with 
package BRugs).

Uwe Ligges





 and BUGS software. Is there any relation between these two? Is there
 any comprehensive package for  Multilevel Logistic modelling in R?
 
 Please guide in this regard.
 
 Thank You
 
 RAZA
 
 
 - Boardwalk for $500? In 2007? Ha!
 
 [[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] multiple plots in a graph

2007-07-12 Thread Uwe Ligges


Ajay Singh wrote:
 Hi,
 I have to generate 10 cdfs in a graph. I need to compare the cdf's 
 nature by plotting ten cdfs in a graph. Thus, I need multiple plots in a 
 graph.
 I would appreciate if you could give some solution to the problem asap.


  plot(ecdf(rnorm(10)))
  plot(ecdf(rnorm(12)), add=TRUE, col.points=red, col.hor=red)

etc...


Uwe Ligges


 Thanking you,
 
 Sincerely,
 
 Ajay.


__
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] adding latex, html docs. to new packag

2007-07-09 Thread Uwe Ligges


Edna Bell wrote:
 Hi again!
 
 How do I create the Latex and HTML files for documentation for a new
 package, please?
 
 Is there something in the R CMD stuff that would do it, or do I need
 to produce by hand, pleaes?


As the manual Writing R Extensions suggests, please write your 
documentation in the Rd format. Those files are converted automatically 
to latex and html (among other format) when the package is installed.

Skeletons for the help files can be generated using prompt() or for a 
whole package, see ?package.skeleton.

Uwe Ligges







 thanks,
 eb
 
 __
 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] Writing Excel (.xls) files on non-Windows OSs using Perl

2007-07-09 Thread Uwe Ligges


Gabor Grothendieck wrote:
 Note that there already is a function, read.xls, in gdata that uses Perl.

Note that Marc talked about *writing* in his original message.

Uwe Ligges


 On 7/9/07, Marc Schwartz [EMAIL PROTECTED] wrote:
 On Mon, 2007-07-09 at 16:42 +0300, Hans-Peter wrote:
 Hi,

 2007/7/8, Marc Schwartz [EMAIL PROTECTED]:
 [snip]
 There exists the xlsReadWrite package on CRAN by Hans-Peter Suter, which
 is restricted to Windows, since it utilizes the non-FOSS MS Office API
 to write the Excel formats.
 The non-FOSS API is not the problem(#) but its implementation is:

 The 3rd party library I use is written in Pascal and supports Delphi
 and Kylix. Kylix would allow to port the package to Linux but as Kylix
 has unfortunately been abandoned by CodeGear (Borland) I am not
 ready/interested to spend my time on this dead road. Though it
 probably could be done quickly.

 A much more interesting way is to port the package using FreePascal.
 -- I plan to do this since long but...
 -- Maybe someone fluent on Linux and FreePascal could have a look at
 the pascal header files (treetron.googlepages.com) and make the demos
 run on Linux..., that would be great and speed up an eventual
 xlsReadWrite port!
 Thanks for the clarification.

 However, I think that if you are going to pursue a cross-platform
 solution, providing source code requiring compilation (as opposed to a
 pre-compiled Windows binary), you should consider what the installation
 requirements for your package would then be.

 If you are going to take the step of requiring a prospective end-user to
 have a particular Pascal compiler in place, you may as well have the
 requirement for a Perl interpreter and associated packages. Since Perl
 is widely available and you are more likely to find Perl-fluent coders
 as opposed to Pascal-fluent coders (eg. I have not used Pascal since the
 late 80's), I would urge you to consider Perl as a future substrate for
 your functions.

 While compiled code will run faster than interpreted code, for these
 types of file I/O functions, I am not sure that you lose much with Perl
 from a performance standpoint and you certainly gain the eyes of a wider
 audience with respect to use, debugging and enhancements.

 To that end, you (or any other interested parties) are free to utilize
 my code in any way you deem appropriate. I did not state this in my
 original post, but I make the code available under GPL(v2), freeing you
 from any restrictions in its use, including your Pro version, as long
 as you make the source available in a fashion consistent with the GPL
 requirements.

 Regards,

 Marc Schwartz

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
 __
 R-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] calculating p-values of columns in a dataframe

2007-07-08 Thread Uwe Ligges


Thomas Pujol wrote:
 I have a dataframe (mydf) that contains differences of means.
 I wish to test whether these differences are significantly different from 
 zero.
 
 Below, I calculate the t-statistic for each column.
 
 What is a good method to calculate/look-up the p-value for each column?
 
 
 mydf=data.frame(a=c(1,-22,3,-4),b=c(5,-6,-7,9))
 
 mymean=mean(mydf)
 mysd=sd(mydf)
 mynn=sapply(mydf, function(x) {sum ( as.numeric(x) = -Inf) })
 myse=mysd/sqrt(mynn)
 myt=mymean/myse
 myt

You can do the whole lot with
   L - lapply(mydf, t.test)
or if you only want the t statistics and p-values now:
   sapply(L, [, c(statistic, p.value))

If you want to follow your initial approach quickly, you can calculate 
the probability function of the t distribution with 3 degrees of freedom 
(for your data) with
   2 * pt(-abs(myt), df = nrow(mydf) - 1)

Uwe Ligges




 
  
 -
 Food fight? Enjoy some healthy debate
 
   [[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] Windows Binary for ncdf package

2007-07-08 Thread Uwe Ligges


amna khan wrote:
 Dear Sir
 
 There is no window binary version of package ncdf in the latest release of R
 2.5.1. i dont have any information about the old versions.
 Please guid in thie regard
 Thank you


See the ReadMe in the CRAN repository. It tells you that ncdf does not 
build out of the box on Windows and is hence not available on CRAN. 
Nevertheless, Brian kindly provides the binary in his CRAN (extras) 
repository (URL http://www.stats.ox.ac.uk/pub/RWin). Just type
   install.packages(ncdf)
and it will be installed ...

Uwe Ligges

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

2007-07-07 Thread Uwe Ligges


Alberto Monteiro wrote:
 Ted Harding wrote:
 So I slickly wrote a recursive definition:

 Nnk-function(n,k){
   if(n==1) {return(k)} else {
 R-0;
 for(r in (1:k)) R-(R+Nnk(n-1,k-r+1)) # ,depth))
   }
   return(R)
 }

 You are aware that this is equivalent to:
 
 Nnk1 - function(n, k) { prod(1:(n+k-1)) / prod(1:n) / prod(1:(k-1)) }

or

Nnk2 - function(n, k) { gamma(n+k) / gamma(n+1) / gamma(k) }

or most easily:

Nnk3 - function(n, k) choose(n+k-1, n)


Uwe Ligges




 aren't you?
  
 ON THAT BASIS: I hereby claim the all-time record for inefficient
 programming in R.

 Challengers are invited to strut their stuff ...

 No, I don't think I can bet you unintentionally, even though
 my second computer program that I ever wrote in life had to be
 aborted, because it consumed all the resources of the computer.
 
 Alberto Monteiro
 
 __
 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] Problem/bug with smooth.spline and all.knots=T

2007-07-05 Thread Uwe Ligges


Hubertus wrote:
 Dear list,
 if I do
   smooth.spline(tmpSec, tmpT, all.knots=T)
 with the attached data, I get this error-message:

Note that you cannot attach data that way. You migth want to upload it 
to some web space and send us the link.

Uwe Ligges




   Error in smooth.spline(tmpSec, tmpT, all.knots = T) :
 smoothing parameter value too small
 If I do
   smooth.spline(tmpSec[-single arbitrary number], tmpT[-single arbitrary 
 number], all.knots=T)
 it works!
 
 I just don't see it. It works for hundrets other datasets, but not for this 
 one.
 Would be glad if anyone could help!
 
 Hubertus
 
 
 
 
 __
 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] Is it a bug ?

2007-07-05 Thread Uwe Ligges
I don't get your point, because

  exp(-(-3)^2.2)
[1] NaN

is correct. A negative value to the power of a non-integer is undefined 
in IR. Of course it is defined as a complex number:

  exp(-(-3+0i)^2.2)
[1] 1.096538e-04-3.47404e-05i

Uwe Ligges




Giuseppe PEDRAZZI wrote:
   [[diverted from R-bugs to R-help by the list maintainer]]
 
 Dear Friend and distinguished R gurus,
 
 first of all really thank you very much for the marvellous tool that is R.
 
 I am using R 2.5.0,  windows XP - italian language.
 
 I was perfoming some calculation on fractional exponential and
 I found a strange behaviour. I do not know if it is really a bug, but I would 
 expect
 a different answer from R.
 
 I was trying the following :
 
 x - seq(-3,3, by =0.1)
 n - 2.2
 y - exp(-x^n)
 
 well, the y vector contains (NaN for all negative value of x)
 
 but if you ask for single value calculation like
 
 y - exp(-(-3)^2.2) or 
 
 y - exp(-(-2.9)^2.2)
 
 the answer is correct. 
 It seem it does not make the calculation in vector form.
 
 I got the same behaviour (NaN)  in a for loop
 
 for(i in 1:length(x)) y[i]=exp(x[i]^n)
 y
  [1]   NaN  NaN  NaN  NaN  NaN
   NaN  NaN  NaN  NaN
 [10]  NaN  NaN  NaN  NaN  NaN 
  NaN  NaN  NaN  NaN
 [19]  NaN  NaN  NaN  NaN  NaN 
  NaN  NaN  NaN  NaN
 [28]  NaN  NaN  NaN 1.00 1.006330 
 1.029416 1.073302 1.142488 1.243137
 [37] 1.384082 1.578166 1.844237 2.210260 2.718282 
 3.432491 4.452553 5.936068 8.137120
 [46]11.47374616.64841524.86768038.25129560.611092
 98.967689   166.572985   289.08   517.425935
 [55]   955.487320  1820.793570  3581.521323  7273.674928 15255.446778 
 33050.861013 73982.100407
 
 Is it strange or did I miss something ?
 
 Many thanks for the attention.
 
 
 Very best regards
 
 Giuseppe Pedrazzi
 Dept Public Health, Physics Division
 University of Parma, Italy
   [[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] The R Book by M. J. Crawley

2007-07-03 Thread Uwe Ligges


Pietrzykowski, Matthew (GE, Research) wrote:
 Hello all-
 
 I would appreciate any guidance that can be provided.  I am new to R and
 am 
 using it exclusively in a statistics program I am undertaking that
 mainly references
 Minitab.  My focus is on data modeling and further more multivariate
 data analysis
 as much of my work in involves chemical measurements from custom sensors
 using
 all sorts of transduction methods.   I am looking for a reference that
 has sound statistical
 foundations with relevant R commands as well as multivariate support.  I
 saw the new book,
 The R Book, by Michael J. Crawley and wanted to know what R users
 thoughts of it.

The author seems to be an expert in (almost?) all available statistical 
programming languages and able to write almost 1000 pages about these 
languages. He also seems to be a perfect R programmer, since the title 
is The R book.

Uwe Ligges


 Thanks in advance,
 
 Matt
 
   [[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] Search a function name in a string

2007-07-03 Thread Uwe Ligges


NOEL Yvonnick wrote:
 Hello,
 
 I am trying to find a function name in a string that expresses a 
 functional form :
 
   s = blabla...S(var)...blabla
 
 I would like to detect the pattern S(*) in s.
 
 I am no guru at regular expressions. Just tried :
 
   grep(S(.*),c(S(a),CSP))

grep(S\\(.*\\),c(S(a),CSP))

Uwe Ligges

 [1] 1 2
  
 
 I expected the pattern to be retrieved only in the first string, so 
 obviously this is not correct. Any idea ?
 
 Thank you very much in advance,
 
 Yvonnick Noel, PhD
 U. of Rennes 2
 France
 
 __
 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] Determining whether a function's return value is assigned

2007-06-30 Thread Uwe Ligges


Paul Laub wrote:
 Dear all,
 
 Does R offer a means by which a function can determine
 whether its return value is assigned? I am using R
 2.4.1 for Windows.

Short answer: No.
Long answer: You want to have a class for the object called bigobject 
below and a print/show method that provides the summary for objects of 
that class.

Uwe Ligges





 
 Suppose what I am looking for is called
 return.value.assigned. Then one might use it like
 this
 
 myfunction - function () {
 # Create bigobject here
 
 if (return.value.assigned()) {
 bigobject
 } else {
 summary(bigobject)
 }
 }
 
 and
 
 x - myfunction()  # bigobject is assigned
 
 myfunction()   # summary of bigobject is printed
 
 Octave and MATLAB have the nargout function that does
 what I want, and Perl has the wantarray function
 detecting the context in which a function is called.
 Perhaps match.call() can be made to do what I want,
 but, if so, I don't see it in reading the
 documentation.
 
 Sincerely,
 
 Paul Laub
 
 __
 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 CMD INSTALL in R 2.5.1 (2007-06-27)

2007-06-30 Thread Uwe Ligges


Fredrik Lundgren wrote:
 Hello,
 
 I'm moving from R 2.2.1 (Winows XP) to R 2.5.1 and have problems with 
 installing myfuncs, which worked OK in 2.2.1
 
 R CMD INSTALL myfuns
 # gives
 installing to ''

Have you set an environment variable such as R_LIBS that is  rather 
than a sensible directory? (my guess)

Are all the tools up to date?
Do you have another library (except the standard one) defined anywhere?
Can you source() all the R files in your package separately in R-2.5.1?

Uwe Ligges



 
 
 -- Making package myfuncs 
   adding build stamp to DESCRIPTION
   installing R files
   installing man source files
   installing indices
   installing help
   Building/Updating help pages for package 'myfuncs'
  Formats: text html latex example chm
   Bland.plottexthtmllatex   example
   Cook.plot texthtmllatex   example
   added.var.plottexthtmllatex   example
   jit.plot  texthtmllatex   example
   waldtest  texthtmllatex   example
   preparing package myfuncs for lazy loading
 Warning in list.files(lib, pattern = paste(^, pkg_regexp, sep = ), 
 full = TR
 UE) :
  list.files: '' is not a readable directory
 Error in findpack(package, lib.loc) : there is no package called 
 'myfuncs'
 Execution halted
 make: *** [lazyload] Error 1
 *** Installation of myfuncs failed ***
 
 Removing '/myfuncs'
 # end
 
 installing to ''  at the start appears to be the problem
 
 I have install Rtools 2.5.1 appropriately ( I hope)
 my PATH looks like this:
 
 PATH=C:\Program\Rtools\MinGW\bin;C:\Program\R\Rtools\bin;c:\program\imagemagick-
 6.1.8-q16;C:\Program\TeXLive\bin\win32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
 \system32\WBEM;C:\Program\Aspell\bin;C:\Program\Perl\bin\;C:\Program\HTML 
 Help W
 orkshop;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program\ATI
  
 T
 echnologies\ATI Control 
 Panel;C:\Program\R\R-2.5.1\bin;C:\Program\sp2000\cmd;C:\
 Program\XEmacs\XEmacs-21.4.13\i586-pc-win32;C:\Program\gnuplot\bin;C:\Program\Ma
 yura;C:\Program files\WinEdt Team\WinEdt;C:\Program\Internet 
 Explorer;;C:\Progra
 m\WinBUGS;C:\Program\Adobe\Acrobat 
 7.0\Reader;C:\Program\QuickTime\QTSystem\
 
 To me looks as if R don't know where to install - any help available?
 
 Sincerely Fredrik Lundgren
 
 __
 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] Installing packages.

2007-06-29 Thread Uwe Ligges


Marcus Vinicius wrote:
 Dear,
 
 I'm not getting Installing packages:
 
 
 install.packages(c(exactRankTests))
 trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
 Content type `text/plain' length 26129 bytes
 opened URL
 downloaded 25Kb


This means you are using R-2.0.x? This is really ancient. Please upgrade 
to a more recent version of R.

Before using function from the installed package, you have to load it:

library(exactRankTests)

Uwe Ligges



 trying URL `http://cran.r-
 project.org/bin/windows/contrib/2.0/exactRankTests_0.8-10.zip'
 Content type `application/zip' length 187723 bytes
 opened URL
 downloaded 183Kb
 
 package 'exactRankTests' successfully unpacked and MD5 sums checked
 
 Delete downloaded files (y/N)? y
 
 updating HTML package descriptions
 ? exactRankTests
 No documentation for 'exactRankTests' in specified packages and libraries:
 you could try 'help.search(exactRankTests)'
 
 
 
 How do I do?
 
 Thanks a lot.
 
 Marcus Vinicius
 
   [[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-2.5.1 problem listing dataframe in GUI/CMDLINE

2007-06-29 Thread Uwe Ligges


Roy Wilson wrote:
 I have a dataframe called hawk. Source file looks ok. read.table seems
 ok. Can view using R editor. Again looks fine.
 
 Now, I am new to windows version of R. When I type in 'hawk' under
 Linux, I expect to see the rows listed. That isn't happening, as shown
 below.
 
 attach(hawk)
 hawk
 Error in print.matrix(as.matrix(format.data.frame(x, digits = digits,  :
 7 arguments passed to 'print.default' which requires 9
 
 Tried this first in 2.5.0. Then installed 2.5.1, tried in both in R
 GUI and R Cmdline. same result. Is this a bug or a mind bug of mine?
 :-)


Quite probably you are using a new version (R-2.5.x) of R but mixing it 
with some packages for a less recent version of R. Do you have some base 
packages for less recent version of R installed in a non-standard 
library that is in the search path? .libPaths() should reveal other 
libraries.

Uwe Ligges




__
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] About Memory size

2007-06-23 Thread Uwe Ligges


Ferdouse Begum wrote:
 Hi,
 I am trying to analyse cancer data set (affymetrix) by
 using bioconductor packages. I have total 14 data set.
 Total size of the data set is 432MB. 

Do you mean it comsumes 432MB to have the data in R or in some format on 
the harddisc?
Do you need to work on the whole datasets at once?
Have you read the manuals and FAQs (there are sections about memory!!!)?


 Now I am trying
 to analyse these data sets in my PC with RAM 512. But


If you need 432MB just to have the data available in R, then you should 
have *at least* 1GB of RAM in your machine, and for certain function, 
you might need much more.

Hence the advise is to rethink how to reduce the problem or to buy 2GB 
of RAM for your machine (which is advisable in any case, because RAM is 
cheap and thinking hurts). We have upgraded all of our computer labs to 
at least 1GB these days.

Uwe Ligges


 if I want to get MAplot of my data set, I am getting
 the messege
 (
 MAplot(ptc.rawData)
 Error: cannot allocate vector of size 73.8 Mb
 In addition: Warning messages:
 1: Reached total allocation of 503Mb: see
 help(memory.size) 
 2: Reached total allocation of 503Mb: see
 help(memory.size) 
 3: Reached total allocation of 503Mb: see
 help(memory.size) 
 4: Reached total allocation of 503Mb: see
 help(memory.size))
 
 Now how can I get rid of this problem? 
 pls help.

 With thanks
 
 Ferdouse
 
 __
 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-pkgs] RGtk2 2.10.x series available

2007-06-21 Thread Uwe Ligges


Prof Brian Ripley wrote:
 Did you not get a dialog box with further details?
 
 Unfortunately I found no instructions.  You need a version of of Gtk2 
 installed that is at least as late as the Windows maintainer used to 
 build RGtk2, as it adapts to the version installed.  I don't know what 
 that is and had to update mine.
 
 http://downloads.sourceforge.net/gladewin32/gtk-2.10.11-win32-1.exe?download 
 
 
 is the latest available, and sufficed for me.
 
 Uwe: could you add a note to the Readme, please, with the version 
 requirement?

Thanks for the hint. I'll do so this afternoon.

Uwe


 
 
 On Thu, 21 Jun 2007, Giulio Barcaroli wrote:
 
 I installed version 2.10.9-1 of RGtk2, but when I tried to load it I
 received the following message:

 local({pkg - select.list(sort(.packages(all.available = TRUE)))

 + if(nchar(pkg)) library(pkg, character.only=TRUE)})

 Error in dyn.load(x, as.logical(local), as.logical(now)) :

unable to load shared library 
 'C:/Programmi/R/R-2.5.0/library/RGtk2/libs/RGtk2.dll':

  LoadLibrary failure:  impossible to find the specified procedure

 Error: package/namespace load failed for 'RGtk2'



 I checked in the directory

 C:/Programmi/R/R-2.5.0/library/RGtk2/libs/

 and the RGtk2.dll module does exist.
 Any indication about how to solve this problem?
 Giulio Barcaroli



__
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] Got Unexpected ELSE error

2007-06-20 Thread Uwe Ligges


Shiazy Fuzzy wrote:
 Dear R-users,
 
 I have a problem with the IF-ELSE syntax.
 Please look at the folllowing code and tell me what's wrong:
 
 a - TRUE
 if ( a )
 {
 cat(TRUE,\n)
 }

At this point, the expression above is complete and it ios evaluated if 
called interactively.
Then, the code below is invalid (there is nothing that starts with else).




 else
 {
 cat(FALSE,\n)
 }


Instead, use:

a - TRUE
if ( a )
{
 cat(TRUE,\n)
} else
{
 cat(FALSE,\n)
}


Uwe Ligges

 If I try to execute with R I get:
  Error: syntax error, unexpected ELSE in else
 The strange thing is either cat instructions are executed!!
 
 My system is: Fedora Core 6 x86_64 + R 2.5.0 (rpm)
 
 Thank you very much in advance
 
 Regards,
 
 -- Marco
 
 __
 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.


  1   2   3   4   5   6   7   8   9   10   >