Re: [R] 'all' inconsistent?

2006-01-30 Thread Giovanni Petris
> I thought all the values are false, all none of them, because there > aren't any that are true: > > any(logical(0)) > [1] FALSE > This is for the same reason why a product over an empty set of factors is 1, and a sum over an empty set of terms is 0. GP --

Re: [R] beginner Q: hashtable or dictionary?

2006-01-30 Thread hadley wickham
> > Is a list O(1) for setting and getting? > > Can you elaborate? R is a vector language, and normally you create a list > in one pass, and you can retrieve multiple elements at once. When you use a hash table you expect it to be O(1) (on average) for getting and setting values (conditional on h

Re: [R] beginner Q: hashtable or dictionary?

2006-01-30 Thread Seth Falcon
> On 1/29/06, context grey <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> Is there something like a hashtable or (python) >> dictionary in R/Splus? On 29 Jan 2006, [EMAIL PROTECTED] wrote: > use a 'list': Most of the time, a list will be what you want, but it has some important differences from a Pyt

Re: [R] matlab-like constant matrix initialization?

2006-01-30 Thread Gabor Grothendieck
Do you mean they are in the clipboard in the format shown? If that is the case then do this: as.matrix(read.table("clipboard")) On 1/30/06, Michael <[EMAIL PROTECTED]> wrote: > Hi all, > > Suppose I have the following matrix which is a constant matrix I've copied > from some other document: >

Re: [R] 'all' inconsistent?

2006-01-30 Thread Seth Falcon
On 29 Jan 2006, [EMAIL PROTECTED] wrote: > On Sun, 29 Jan 2006, Elizabeth Purdom wrote: > >> I came across the following behavior, which seems illogical to me. > > What did you expect and why? > >> I don't know if it is a bug or if I'm missing something: >> >>> all(logical(0)) >> [1] TRUE > > All

Re: [R] match() & seq()

2006-01-30 Thread Roger Bivand
On Mon, 30 Jan 2006, Jacques VESLOT wrote: > sorry if it has already been discussed but i can't understand this: > > > seq(0.1,1,by=0.1) > [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 > > match(0.1,seq(0.1,1,by=0.1)) > [1] 1 > > match(0.2,seq(0.1,1,by=0.1)) > [1] 2 > > match(0.3,seq(0.1,1,by=

Re: [R] R on dual-core machines

2006-01-30 Thread Prof Brian Ripley
On Mon, 30 Jan 2006, [iso-8859-2] Alea }iberna wrote: > Dear expeRts! > > I'm thinking of buying a new computer and am considering dual-core > processors, such as AMD Athlon64 X2. Since I'm not a computer expert, pleas > forgive me if some of my questions are silly. > > First, am I correct that us

Re: [R] match() & seq()

2006-01-30 Thread Dimitris Rizopoulos
the problem is in 0.3 == seq(0.1,1,by=0.1)[3] versus all.equal(0.3, seq(0.1,1,by=0.1)[3]) look at ?Comparison for more info. I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnen

Re: [R] match() & seq()

2006-01-30 Thread Liaw, Andy
Hope this is clear: > x <- seq(0.1, 1, by=0.1) > 0.3 == x[3] [1] FALSE > abs(0.3 - x[3]) [1] 5.551115e-17 Andy From: Jacques VESLOT > > sorry if it has already been discussed but i can't understand this: > > > seq(0.1,1,by=0.1) > [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 > > match(0.1,se

Re: [R] lme4_0.995-2/Matrix_0.995-4 upgrade introduces error messages (change management)

2006-01-30 Thread Douglas Bates
Thanks Charles. The error is occuring in a fit of a glm using the fixed-effects terms only. This fit provides the starting estimates for the fixed effects in the GLMM model. I changed the way that this fit is performed and apparently didn't do it correctly. I think it would be better if you and

[R] match() & seq()

2006-01-30 Thread Jacques VESLOT
sorry if it has already been discussed but i can't understand this: > seq(0.1,1,by=0.1) [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 > match(0.1,seq(0.1,1,by=0.1)) [1] 1 > match(0.2,seq(0.1,1,by=0.1)) [1] 2 > match(0.3,seq(0.1,1,by=0.1)) [1] NA > match(0.4,seq(0.1,1,by=0.1)) [1] 4 > R.versi

Re: [R] Help with R: functions

2006-01-30 Thread Liaw, Andy
This might be a bit closer to what Pryseley wanted: st <- function(dat, x, y) { f <- formula(substitute(y ~ x), env=environment(dat)) plot(f, dat) abline(lm(f, dat)) } Note that the variable names in the plot when tested on `dats' as Pryseley created. Andy From: Jacques VESLOT > >

Re: [R] lme4_0.995-2/Matrix_0.995-4 upgrade introduces error messages (change management)

2006-01-30 Thread White, Charles E WRAIR-Wash DC
I hope I'm not making your life unnecessarily difficult. As I will demonstrate below my signature, my original straight application of lme4_0.995-2/Matrix_0.995-4 is failing without providing any optimization information. For reference, I've provided optimization output from lme4_0.995-1/Matrix_0.9

Re: [R] SoS! How to predict new values using linear regression models?

2006-01-30 Thread Petr Pikal
Hi On 29 Jan 2006 at 17:28, Gabor Grothendieck wrote: Date sent: Sun, 29 Jan 2006 17:28:29 -0500 From: Gabor Grothendieck <[EMAIL PROTECTED]> To: Michael <[EMAIL PROTECTED]> Copies to: R-help@stat.math.ethz.ch Subject:

Re: [R] Help with R: functions

2006-01-30 Thread Jacques VESLOT
st <- function(data, x, y){ attach(data) rcc <- coef(lm(y~x)) plot(x,y) abline(rcc) detach(data)} st(data=dats, x=visual24, y=visual52) Pryseley Assam a écrit : >Hello R-users > > I am new to R and trying to write some functions. I have problems writing > functions tha

Re: [R] Help with R: functions

2006-01-30 Thread Philippe Grosjean
# Here it is (using the formula interface): dats <- data.frame(visual24 = rnorm(30, 3, 5), visual52 = rt(30, 7)) st <- function(formula, data, ...) { # Just use the formula to specify which variables to use rcc <- coef(lm(formula, data)) # Make sure to k

Re: [R] Help with R: functions

2006-01-30 Thread TEMPL Matthias
What is wrong with your first solution: st <-function(x,y){ ## y ... Response ## x ... terms rcc<-coef(lm(y ~ x)) plot(x,y) abline(rcc[1],rcc[2]) } st(dats$visual24,dats$visual52) Or use attach: st <-function(data,x,y){ attach(data) rcc<-coef(lm(x~y)) plot(x,y) abline(rcc[

Re: [R] can I do this with read.table??

2006-01-30 Thread Petr Pikal
Hi Well, colClesses can be used for what you want to do. See > test<-read.table("c:/temp/test.txt", colClasses=c("character","numeric", "character", "factor")) > str(test) `data.frame': 10 obs. of 3 variables: $ doba : num 189 256 286 105 272 45 29.5 43 68.5 99 $ otac : chr "0.6" "0.6" "0

Re: [R] problem with mirror selection

2006-01-30 Thread Liaw, Andy
You didn't say if you did the selection from the menu or the command line... In any case, the menu `Packages' -> `Set CRAN Mirror...' runs the command chooseCRANmirror(), which looks like > chooseCRANmirror function (graphics = TRUE) { if (!interactive()) stop("cannot choose a CRAN

[R] Help with R: functions

2006-01-30 Thread Pryseley Assam
Hello R-users I am new to R and trying to write some functions. I have problems writing functions that takes a data set as an arguement and uses variables in the data. I illustrate my problem with a small example below: sample data #-- visual24<-rnorm(30,3,5) v

Re: [R] Varying results of sammon(), for the same data set

2006-01-30 Thread Prof Brian Ripley
On Mon, 30 Jan 2006, Ole Edsberg wrote: > Hello, > > I have a data set on which I run the sammon algorithm as follows: > > library(MASS) > data = read.table('problemforr.dat') Hmm. This is a data frame of 387 rows and 387 columns and Euclidean distance is used. Squeezing 387 dims (and PCA show

Re: [R] R on dual-core machines

2006-01-30 Thread Uwe Ligges
Yes, you are right, and you found some relevant posts. Uwe Ligges Aleš Žiberna wrote: > Dear expeRts! > > I'm thinking of buying a new computer and am considering dual-core > processors, such as AMD Athlon64 X2. Since I'm not a computer expert, pleas > forgive me if some of my questions are si

[R] R on dual-core machines

2006-01-30 Thread Aleš Žiberna
Dear expeRts! I'm thinking of buying a new computer and am considering dual-core processors, such as AMD Athlon64 X2. Since I'm not a computer expert, pleas forgive me if some of my questions are silly. First, am I correct that using a dual-core processor is (for R point of view) the same as usin

Re: [R] yet another vectorization question

2006-01-30 Thread Philippe Grosjean
Hello, Not exactly the same. By the way, why do you use do.call()? Couldn't you do simply: expand.grid(split(t(replicate(3, c(0, 1, NA))), 1:3)) Best, Philippe Grosjean Jacques VESLOT wrote: > this looks similar: > do.call(expand.grid,split(t(replicate(3,c(0,1,NA))),1:3)) > > > Adrian DUSA

Re: [R] multiple hystograms

2006-01-30 Thread Aleš Žiberna
See ?par Look for arguments mfrow and mfcol Hope this is what you are looking for, Ales Ziberna -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of R Granell, Medicine Sent: Monday, January 30, 2006 12:35 PM To: r-help@stat.math.ethz.ch Subject: [R] multip

Re: [R] yet another vectorization question

2006-01-30 Thread Jacques VESLOT
this looks similar: do.call(expand.grid,split(t(replicate(3,c(0,1,NA))),1:3)) Adrian DUSA a écrit : >Dear R-helpers, > >I'm trying to develop a function which specifies all possible expressions that >can be formed using a certain number of variables. For example, with three >variables A, B and

Re: [R] yet another vectorization question

2006-01-30 Thread Adrian DUSA
Adrian DUSA roda.ro> writes: > > I'm trying to develop a function [...snip...] Sorry for the traffic, I forgot to say that I'm using library(combinat) for the "combn" function... Thank you, Adrian __ R-help@stat.math.ethz.ch mailing list https://stat

[R] multiple hystograms

2006-01-30 Thread R Granell, Medicine
Hello, Here comes a simple question: Is there a way of obtaining more than one histogram in the graph-window so you can edit all the plots simultaneously? and how about scatter plots? Thanks in advance __ R-help@stat.math.ethz.ch mailing list https:

[R] yet another vectorization question

2006-01-30 Thread Adrian DUSA
Dear R-helpers, I'm trying to develop a function which specifies all possible expressions that can be formed using a certain number of variables. For example, with three variables A, B and C we can have - presence/absence of A; B and C - presence/absence of combinations of two of them - presence

[R] Filtering the time series

2006-01-30 Thread anil kumar rohilla
Hi List, I have a time series of 122 values, actualy it is a time series of daily indian monsoon rainfall. now i want to filter this time series for a particular oscilation say 10 to 20days oscilation. i want to find out what amount of variance is explained by this mode. Which package is

Re: [R] matlab-like constant matrix initialization?

2006-01-30 Thread Hans-Peter
> Suppose I have the following matrix which is a constant matrix I've copied > from some other document: > > 1.2 3.4 1.4 ... > 2.3 3.7 2.6 ... > ... > How do I make it into a matrix or array in R? > What is the fastest way of initializing a constant matrix with this > copy/pasted values? you can

Re: [R] matlab-like constant matrix initialization?

2006-01-30 Thread Philippe Grosjean
Sorry Michael, but I don't understand your question. If you want to intialize a constant matrix (there is not such thing in R, just create a numerical matrix and use it without changing its values), you just use matrix(). For help and arguments of the function, type: > ?matrix Best, Philippe

[R] Varying results of sammon(), for the same data set

2006-01-30 Thread Ole Edsberg
Hello, I have a data set on which I run the sammon algorithm as follows: library(MASS) data = read.table('problemforr.dat') y = cmdscale(data, add=TRUE) s = sammon(data, y$points) (In case it should be relevant, I make the data available at http://idi.ntnu.no/~edsberg/problemforr.dat) With R 2.

[R] matlab-like constant matrix initialization?

2006-01-30 Thread Michael
Hi all, Suppose I have the following matrix which is a constant matrix I've copied from some other document: 1.2 3.4 1.4 ... 2.3 3.7 2.6 ... ... How do I make it into a matrix or array in R? What is the fastest way of initializing a constant matrix with this copy/pasted values? Thanks a lot!

[R] textplot from gplots package

2006-01-30 Thread Aitor Mata Conde
Hi!! I've had some problems with the new version of textplot, included in the gplots package. (some kind of postscript problem) I wonder if any of you have used this function or if there is any other R funcion to show the text in a R object as an image. Thanks in advance, A

<    1   2