[R] Evaluating R function in C code

2004-09-08 Thread Manoj - Hachibushu Capital
Dear All, For the following C code: SEXP testR(SEXP rho) { SEXP evalStr,evalRes; Char cmdstr[1024]; SEXP val; /* Get the value of variable 'val' defined already in the R environ */ PROTECT(val = findVar(install("val"),

Re: [R] Problem installing R

2004-09-08 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Niggley, Jason wrote: > As I am installing R for windows, I get the following error: > > "C:\ProgramFiles\R\rw1091\library\stats\chtml\stats.chm Is that really not Program Files? > An error occurred while trying to copy a file: > > The source file is corrupted." > > Can yo

Re: [R] Cox regression for prevalence estimates

2004-09-08 Thread The Michaelson Institute
Thnks to Prof. Frank E Harrell Jr , Prof. Bernardo Rangel Tura, and Prof. Thomas Lumley for their response. Tomas Karpati (MD) The Michaelson Institute for the prevention of Blindness Hadassah Medical Org. email: [EMAIL PROTECTED] Phone: +972-2-6256458, fax: +972-2-6232895 On Tue, 07 Sep 2004 1

Re: [R] factor always have type integer

2004-09-08 Thread Prof Brian Ripley
On Thu, 9 Sep 2004, Erich Neuwirth wrote: > The simple answer to my problem (are the values of a vector > numeric or not) is is.numeric, and that is enough for > what I need right now. > But this way I do not get an answer discriminating between > integers and and doubles. What is the canonical wa

Re: [R] factor always have type integer

2004-09-08 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Erich Neuwirth wrote: > The function I need is > valtype<-function(x) > typeof(ifelse(is.factor(x),levels(x),x)) > > It is easy enough to write. > Are there any other special cases where the values > and the storage mode differ? All classed objects are more than the int

Re: [R] factor always have type integer

2004-09-08 Thread Gabor Grothendieck
Note that I(v2) stores v2 as type character but not as class character. For example, R> DF <- data.frame(x = c("a", "b"), y = I(c("a", "b")), z = I(c("a", "b"))) R> class(DF$z) <- "character" R> sapply(DF, typeof) # y and z do have the same type x y z "integer"

Re: [R] Skipping panels in Lattice

2004-09-08 Thread Deepayan Sarkar
On Wednesday 08 September 2004 23:18, Leon Barmuta wrote: > Dear all, > > I wish to generate a lattice boxplot which skips an empty cell in a > design. I have trawled r-help, scruitinized xyplot(lattice) help > page, and merrily reproduced examples of using skip from a couple of > previous r-help q

Re: [R] How to do this "combination"?

2004-09-08 Thread Gabor Grothendieck
ucalgary.ca> writes: : source vector = (1,2) : the length of the target vector = 3 : : solution2: as.matrix(expand.grid(1:2, 1:2, 1:2)) almost implements what I : need. : : However, in my case, the length of the target vector is not fixed in : advance. For example, the output might be

[R] Skipping panels in Lattice

2004-09-08 Thread Leon Barmuta
Dear all, I wish to generate a lattice boxplot which skips an empty cell in a design. I have trawled r-help, scruitinized xyplot(lattice) help page, and merrily reproduced examples of using skip from a couple of previous r-help queries and the example given in Pinheiro & Bates. But I must be mis

Re: [R] isoMDS

2004-09-08 Thread Kjetil Brinchmann Halvorsen
Doran, Harold wrote: Thank you. Quick clarification. isoMDS only works with dissimilarities. Converting my similarity matrix into the dissimilarity matrix is done as (from an email I found on the archives) d<- max(tt)-tt Mardia, kent & Bibby defines the "standard transformation" from a

Re: [R] howto load functions?

2004-09-08 Thread Kevin Wang
Hi, Loren Grimes wrote: I realize that this is pretty basic, and I should be able to figure this out: but, how do I write a function [with a text editor] and then load it into an interactive R session? Thanks Try ?source HTH, Kevin -- Ko-Kang Kevin Wang PhD Student Centre for Mathematics and its

[R] howto load functions?

2004-09-08 Thread Loren Grimes
I realize that this is pretty basic, and I should be able to figure this out: but, how do I write a function [with a text editor] and then load it into an interactive R session? Thanks -- ___ Sign-up for Ads Free at Mail.com http://promo

RE: [R] How to do this "combination"?

2004-09-08 Thread Liaw, Andy
> n <- 2 > p <- 5 > m <- do.call("expand.grid", data.frame(matrix(rep(1:n, p), n, p))) > do.call("paste", c(m, sep="")) [1] "1" "2" "12111" "22111" "11211" "21211" "12211" "22211" "11121" "21121" [11] "12121" "22121" "11221" "21221" "12221" "1" "2" "21112" "12112" "22112" [21] "112

Re: [R] How to do this "combination" ?

2004-09-08 Thread Erich Neuwirth
combinat<-function(els,len){ if (len==1) (return(as.character(els))) else return(as.vector(t(outer(combinat(els,len-1),as.character(els), function(x,y)paste(x,y,sep="") } combinat(1:2,3) does what you want [EMAIL PROTECTED] wrote: Thanks David first. Probably, David misunderstood my points

[R] How to do this "combination"?

2004-09-08 Thread wanr
Hi all, source vector = (1,2) the length of the target vector = 3 My expected "complete" output should be: 111, 112, 121, 122, 211, 212, 221, 222 (they are Not numerical numbers, they are equivalent to abc and aab etc.). Not perfect solutions suggested by others so far: solution1: sample(c(

[R] Problem installing R

2004-09-08 Thread Niggley, Jason
As I am installing R for windows, I get the following error: "C:\ProgramFiles\R\rw1091\library\stats\chtml\stats.chm An error occurred while trying to copy a file: The source file is corrupted." Can you help me? Jason [[alternative HTML version deleted]] ___

Re: [R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
The simple answer to my problem (are the values of a vector numeric or not) is is.numeric, and that is enough for what I need right now. But this way I do not get an answer discriminating between integers and and doubles. What is the canonical way of getting the type of the values of a vector? Is t

RE: [R] factor always have type integer

2004-09-08 Thread Berton Gunter
> Therefore, I would like to know if there are other types of variables > (besides factors) which give a misunderstandable answer about > the type > of their values when asked typeof. Your question is a bit combative, don't you think? R performs as documented, so I think your characterization is

RE: [R] How to do this "combination" ?

2004-09-08 Thread Liaw, Andy
Try: > m <- as.matrix(expand.grid(1:2, 1:2, 1:2)) > x <- m[,1] * 100 + m[,2] * 10 + m[,3] > x 1 2 3 4 5 6 7 8 111 211 121 221 112 212 122 222 Note that if the `source vector' is not 1:k for some integer k, you need to coerce the output of expand.grid, as that returns a data fram

RE: [R] confidence intervals

2004-09-08 Thread Warnes, Gregory R
You should be able to make small modifications to the ci.lme function provided in the gregmisc/gmodels package. -Greg > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Spencer Graves > Sent: Friday, September 03, 2004 11:58 AM > To: [EMAIL PROTECTED] >

[R] How to do this "combination" ?

2004-09-08 Thread wanr
Thanks David first. Probably, David misunderstood my points. source vector = (1,2) the length of the target vector = 3 My expected "complete" outputs should be: 111, 112, 121, 122, 211, 212, 221, 222. sample(c(1,2),3,replace=TRUE) just gives me one "randomly sampled" combination at a time. How

Re: [R] cbind in a loop

2004-09-08 Thread Sundar Dorai-Raj
Jan Wantia wrote: Dear all, I have a problem with adding columns to a data structure, using 'cbind': I create an array, to which I want to cbind one new colum for every iteration of a loop. Without the loop, the code works and looks like this: > Min<- array(0,c(129,0)) > Min [1,] [2,] [3,]

Re: [R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
The function I need is valtype<-function(x) typeof(ifelse(is.factor(x),levels(x),x)) It is easy enough to write. Are there any other special cases where the values and the storage mode differ? The background for all this is that I am transferring data from R to Excel with VBA and I have to

[R] cbind in a loop

2004-09-08 Thread Jan Wantia
Dear all, I have a problem with adding columns to a data structure, using 'cbind': I create an array, to which I want to cbind one new colum for every iteration of a loop. Without the loop, the code works and looks like this: > Min<- array(0,c(129,0)) > Min [1,] [2,] [3,] [4,] etc.. > file

Re: [R] How to draw an observation uniformly from a given dataset?

2004-09-08 Thread Roger D. Peng
[EMAIL PROTECTED] wrote: Hi all, I have two questions stated below: 1. How to draw an observation uniformly from a given data? For example, I have a dataset (or dataframe) with 10 observations (with a set of variables) and I want to "uniformly" select an observation from this given dataset, that

Re: [R] How to draw an observation uniformly from a given dataset?

2004-09-08 Thread David Forrest
On Wed, 8 Sep 2004 [EMAIL PROTECTED] wrote: > Hi all, > > I have two questions stated below: > > 1. How to draw an observation uniformly from a given data? > > For example, I have a dataset (or dataframe) with 10 observations (with a > set of variables) and I want to "uniformly" select an observat

[R] How to draw an observation uniformly from a given dataset?

2004-09-08 Thread wanr
Hi all, I have two questions stated below: 1. How to draw an observation uniformly from a given data? For example, I have a dataset (or dataframe) with 10 observations (with a set of variables) and I want to "uniformly" select an observation from this given dataset, that is, the probability of

Re: [R] factor always have type integer

2004-09-08 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Erich Neuwirth wrote: > typeof applied to a factor always seems to return "integer", > independently of the type of the levels. typeof is telling you the internal structure. From ?factor 'factor' returns an object of class '"factor"' which has a set of integer codes

[R] R/S-plus Course***In Princeton & Boston, ***R/Splus Fundamentals and Programming Techniques, september - October, 2004

2004-09-08 Thread elvis
R/S-plus Course***In Princeton & Boston,***R/Splus Fundamentals and Programming Techniques, september - October, 2004 XLSolutions Corporation (www.xlsolutions-corp.com) is proud to announce 2-day "R/S-plus Fundamentals and Programming Techniques". Princeton,NJ

Re: [R] factor always have type integer

2004-09-08 Thread Roger D. Peng
In some cases it makes sense to store "character" variables as factors (integers with labels) since this can take up much less memory. If you really want to store `v2' as character, just do data.frame(v1, I(v2)) -roger Erich Neuwirth wrote: typeof applied to a factor always seems to return "int

RE: [R] factor always have type integer

2004-09-08 Thread Liaw, Andy
?data.frame says: Details: A data frame is a list of variables of the same length with unique row names, given class '"data.frame"'. 'data.frame' converts each of its arguments to a data frame by calling 'as.data.frame(optional=TRUE)'. As that is a generic function, met

[R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
typeof applied to a factor always seems to return "integer", independently of the type of the levels. This has a strange side effect. When a variable is "imported" into a data frame, its type changes. character variables automatically are converted to factors when imported into data frames. Here is

Re: [R] Problems loading Lapack library

2004-09-08 Thread Prof Brian Ripley
Haven't you sent this before? d_sign is part of the Fortran runtime support. Since you are running sunperf, you should not have been building libRlapack at all. Please don't try to outsmart R, but let it decide what configuration to try. Once that works, feel free to try to improve it. My gue

RE: [R] Contrast matrices for nested factors

2004-09-08 Thread Warnes, Gregory R
You should be able to get the behavior you want using the fit.glh() (short for fit general linear hypothesis) function from the gregmisc/gmodels package. -G > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > Fernando Henrique > Ferraz P. da Rosa > Sen

[R] Problems loading Lapack library

2004-09-08 Thread Ed Hughes
I have just installed R 1.9.1 on an old Sun Sparc with the following specs: version Machine hardware: sun4u OS version: 5.6 Processor type: sparc Hardware: SUNW,Ultra-4 The following components are installed on your system: Sun Visual WorkShop C++ 3.0 Sun WorkShop C

RE: [R] isoMDS

2004-09-08 Thread Doran, Harold
Thank you. Quick clarification. isoMDS only works with dissimilarities. Converting my similarity matrix into the dissimilarity matrix is done as (from an email I found on the archives) > d<- max(tt)-tt Where tt is the similarity matrix. With this, I tried isoMDS as follows: > tt.mds<-isoMDS(d)

[R] Installing packages on OS X

2004-09-08 Thread hadley wickham
On my computer, it seems that (binary?) packages installed through the GUI in RAqua are not used available to the command line version of R, while (source) packages installed with R CMD INSTALL are available to both. This is a problem when I run R CMD CHECK on a package that I am creating that dep

RE: [R] heatmap help

2004-09-08 Thread Paul Lepp
Thanks Marta (and Andy). Between the two of you I think I got the result I was looking for. I ended up doing the following: heatmap(x, distfun=function(x) as.dist(x)) Thanks again. > -Original Message- > From: Marta Rufino [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 08, 2004

Re: [R] rodbc windows doesn't find dsn

2004-09-08 Thread Jack Tanner
Prof Brian Ripley wrote: Well, we don't know what you are doing! RODBC does work with system DSNs, but did you try odbcDriverConnect? Let me read the help page for you odbcDriverConnect("DSN=foo") works, but odbcConnect("foo") fails as described earlier. Is this as intended? This seems weird, be

Re: [R] degrees of freedom (lme4 and nlme)

2004-09-08 Thread Elizabeth Lynch
Hi, I'm looking for pointers/references on calculating den DF's for fixed effects when using crossed random effects. Also, is there an implementation of simulate.lme that I could use in lme4? Thanks, Elizabeth Lynch Douglas Bates wrote: Alexandre Galvão Patriota wrote: Hi, I'm having some proble

RE: [R] local linear embedding

2004-09-08 Thread Liaw, Andy
Hi Adele, The Matlab code at http://www.cs.toronto.edu/~roweis/lle/code/lle.m seems fairly straightforward to translate to R, so that would be the first thing I'd try. However, one can obviously use better algorithms for sub-tasks within that code, e.g., for finding k-NNs. Best, Andy > From: Ad

RE: [R] do.call("[", ...) question

2004-09-08 Thread Kevin Bartz
This worked very well for me: do.call("[", c(list(a), jj)) What about you? Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robin Hankin Sent: Wednesday, September 08, 2004 7:08 AM To: [EMAIL PROTECTED] Subject: [R] do.call("[", ...) question Hi a

[R] local linear embedding

2004-09-08 Thread Adele Cutler
Is anyone working on interfacing local linear embedding (Saul and Roweis) to R? The only mention I found was in the article "Dimension Reduction for Data Mapping" (Edwards and Oman) in RNews 3/3. Adele __ [EMAIL PROTECTED] mailing list https://stat.et

RE: [R] isoMDS

2004-09-08 Thread Hanke, Alex
I don't understand. If isoMDS does not work with distances, why does the help for isoMDS indicate that the "Data are assumed to be dissimilarities or relative distances" ? Equally confusing is the loose use of the terms dissimilarities and distances in the literature. As you point out in your book

Re: [R] Sweave echoing comments (again)

2004-09-08 Thread Wolski
Hi! I observed it also. There are cases where it is not desirable. It will be quite helpfull, if possible, to have a parameter that allows one to switch of removing the #comments. /E *** REPLY SEPARATOR *** On 9/6/2004 at 1:30 PM Thomas Petzoldt wrote: >>>Hello, >>> >>>I tr

RE: [R] isoMDS

2004-09-08 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Hanke, Alex wrote: > Distances cannot always be constructed from similarities. This can be done > only if the matrix of similarities is nonnegative definite. With the > nonnegative definite condition, and with the maximum similarity scaled so > that s_ii=1, d_ik=(2*(1-s_ik))^-.

Re: [R] do.call("[", ...) question

2004-09-08 Thread Peter Dalgaard
Robin Hankin <[EMAIL PROTECTED]> writes: > Hi again everyone > > I have an arbitrarily dimensional array "a" and a list "jj" of length > length(dim(a)).The elements of jj are vectors of indexes. > > How do I use do.call() to extract a[ jj[[1]], jj[[2]], jj[[3]], ...] ? > > > Toy example fo

RE: [R] isoMDS

2004-09-08 Thread Hanke, Alex
Distances cannot always be constructed from similarities. This can be done only if the matrix of similarities is nonnegative definite. With the nonnegative definite condition, and with the maximum similarity scaled so that s_ii=1, d_ik=(2*(1-s_ik))^-.5 Check out the vegan package. Alex -Origi

Re: [R] do.call("[", ...) question

2004-09-08 Thread Dimitris Rizopoulos
Hi Robin, you could try the following: lis <- lapply(seq(1, length(dim(a))+1), function(x,a.,jj.) if(x==1) a. else jj.[[x-1]] ,a.=a, jj.=jj) do.call("[",lis) I hope this helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic Universi

[R] do.call("[", ...) question

2004-09-08 Thread Robin Hankin
Hi again everyone I have an arbitrarily dimensional array "a" and a list "jj" of length length(dim(a)).The elements of jj are vectors of indexes. How do I use do.call() to extract a[ jj[[1]], jj[[2]], jj[[3]], ...] ? Toy example follows: a <- matrix(1:30,5,6) jj <- list(5:1,6:1) I want the foll

[R] Stefan Albrecht/HV/Finanzen/Allianz-Sach ist außer Haus. : R-help Digest, Vol 19, Issue 8

2004-09-08 Thread stefan . albrecht
Ich werde ab 09/08/2004 nicht im Büro sein. Ich kehre zurück am 09/27/2004. Ich werde Ihre Nachricht nach meiner Rückkehr beantworten. Ursprüngliches Thema: R-help Digest, Vol 19, Issue 8 [[alternative HTML version deleted]] __ [EMAIL PRO

Re: [R] isoMDS

2004-09-08 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Doran, Harold wrote: > 1)Can isoMDS work only with dissimilarities? Or, is there a way > that it can perform the analysis on the similarity matrix as I have > described it? Yes. The method, as well as the function in package MASS. All other MDS packages are doing a conv

Re: [R] plot.dendrogram

2004-09-08 Thread Adaikalavan Ramasamy
Try setting something like "cex=0.5" in the plot. It works for at least hclust. Here is a quick example using hclust to show how you can get away with set the colours. data(USArrests) hc <- hclust(dist(USArrests), "ave") plot(hc, hang=-1, cex=0.5) labels <- rownames(USArrests)[ hc$order]; n <- le

[R] Case-Cohort Analysis

2004-09-08 Thread petertait
Hi All, I am in the middle of doing an analysis of a Case-Cohort design. I had three questions about the analysis: a) Does any one know of some public code for developing the patient risk sets (indexed by failure time) or is there a better way to organize the data? b) I was planning to use th

[R] isoMDS

2004-09-08 Thread Doran, Harold
Dear List: I have a question regarding an MDS procedure that I am accustomed to using. I have searched around the archives a bit and the help doc and still need a little assistance. The package isoMDS is what I need to perform the non-metric scaling, but I am working with similarity matrices, not

[R] Contract for an R and Stats specialist

2004-09-08 Thread Paul Hussein
Hi all, We have a genuine requirement for Statistical Programmer with experience and knowledge of: . R programming, and . Oracle data base This is to work on an a short term project for a research centre in italy. If anyone would like further information, please feel free to email

Re: [R] 64 bit R slower than 32 bit R on Sun Sparc Solaris?

2004-09-08 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Jason Liao wrote: > Thank you very much, Profs. Ripley and Peng! It corrected a big > misconception in my mind. > > By the way, does the Sun Forte 7 compiler produce faster R than the GCC > 3.4.1 compiler (which we use)? Not in my experience, although libsunperf helps a lot

Re: [R] 64 bit R slower than 32 bit R on Sun Sparc Solaris?

2004-09-08 Thread Jason Liao
Thank you very much, Profs. Ripley and Peng! It corrected a big misconception in my mind. By the way, does the Sun Forte 7 compiler produce faster R than the GCC 3.4.1 compiler (which we use)? Jason --- Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > On Tue, 7 Sep 2004, Roger D. Peng wrote: >

[R] plot.dendrogram

2004-09-08 Thread Marta Rufino
Dear R-users, I would like to change the labels size and format in the node ends of a dendrogram, how can I do it? How can I use different symbols/colors in each node ends ? I manage to do it with plot.cluster, but heat map uses plot.dendrogram. Can anyone help me please? thank you Marta

Re: [R] Multiple comparisons in a non parametric case

2004-09-08 Thread Marco Chiarandini
Thanks Rolf and Thomas, > It looks to me like what you are doing is trying to judge > significance of differences by non-overlap of single-sample > confidence intervals. While this is appealing, it's not quite > right. Yes, this is what I am trying to do. Apparently, when the replicates are th

Re: [R] heatmap help

2004-09-08 Thread Marta Rufino
Hello, I was just doing heatmaps myself ;-) and I had the same problem. It would be nice to have such an example in the help file because it is not clear (thank you). you use (for example... this is my case, which I am doing the distance matrix using vegdist function with Bray curtis similarity):

Re: [R] download of 1.9.1

2004-09-08 Thread Prof Brian Ripley
On 8 Sep 2004, Peter Dalgaard wrote: > Kevin Wang <[EMAIL PROTECTED]> writes: > > On Tue, 7 Sep 2004, Kathy DeRiemer wrote: > > > I downloaded version 1.9.1 WinZip file, 9.367 bytes (so I can update my R > > > > Uit doesn't sound right, 9 bytes > > Or 9K ? Still not making sense. R

Re: [R] download of 1.9.1

2004-09-08 Thread Peter Dalgaard
Kevin Wang <[EMAIL PROTECTED]> writes: > Hi, > > On Tue, 7 Sep 2004, Kathy DeRiemer wrote: > > > Hi there, > > > > I downloaded version 1.9.1 WinZip file, 9.367 bytes ( so I can update my R > > Uit doesn't sound right, 9 bytes Or 9K ? Still not making sense. The windows install fil