[R] Why the factor levels returned by cut() are not ordered?

2006-11-29 Thread Wolfram Fischer
What is the reason, that the levels of the factor returned by cut() are not marked as ordered levels? > is.ordered( cut( breaks=3, sample(10 ) ) ) FALSE > help(factor) ... If 'ordered' is 'TRUE', the factor levels are assumed to be ordered. ... Wolfram __

Re: [R] Aggregating data

2006-11-29 Thread Petr Pikal
Similar answer as last time aggregate, tapply, by or ppackage doBy HTH PS. If you want to add some other text then subject in your post do not use HTML posting as recommended in posting guide. Petr On 28 Nov 2006 at 22:04, David Kaplan wrote: Date sent: Tue, 28 Nov 2006 22:04:0

Re: [R] GAMS and Knots

2006-11-29 Thread Simon Wood
The number of knots is really one of the modelling assumptions. Provided you don't make it restrictively small then the results should not be very sensitive to this assumption, since the actual degrees of freedom of each smooth are determined by how heavily the smooth is penalized, rather than

Re: [R] R2.4 xyplot + panel.number problem

2006-11-29 Thread Gabor Grothendieck
As requested on last line of every message to r-help please provide self contained reproducible code. Also please space it properly since its very difficult to read in your post. I have used the models defined in example(Puromycin) in place of your undefined ones and made some changes to keep the

Re: [R] Why the factor levels returned by cut() are not ordered?

2006-11-29 Thread Petr Pikal
Hi it is not stated that the cut shall return ordered factor. If you want you can use ordered(cut( breaks=3, sample(10 ) )) or modify code for cut.default to accept ordered switch. HTH Petr On 29 Nov 2006 at 9:59, Wolfram Fischer wrote: Date sent: Wed, 29 Nov 2006 09:59:36 +01

Re: [R] Why the factor levels returned by cut() are not ordered?

2006-11-29 Thread Bjørn-Helge Mevik
Wolfram Fischer wrote: > What is the reason, that the levels of the factor > returned by cut() are not marked as ordered levels? I don't know, but you can always make it ordered with ordered(cut(breaks = 3, sample(10))) >> help(factor) > ... > If 'ordered' is 'TRUE', the factor levels a

Re: [R] comma delimiter & comma in text

2006-11-29 Thread Philipp Pagel
> 1, A, 24, The Red House > 2, A, 25, King's Home, by the Sea > ... > Is there a way i can specify to R that "King's Home, by the Sea" is one > word? Yes: It needs to be quoted in the file: 2, A, 25, "King's Home, by the Sea" cu Philipp -- Dr. Philipp Pagel

Re: [R] comma delimiter & comma in text

2006-11-29 Thread Romain Francois
Alexander Nervedi wrote: > Hi > > I have data like > > 1, A, 24, The Red House > 2, A, 25, King's Home, by the Sea > ... > > I'd like to read this in as three variables. I first tried > > temp <-read.csv(addresses, sep = "," ) it worked but line 2 was broken > after King's Home, and by the Sea as

Re: [R] Why the factor levels returned by cut() are not ordered?

2006-11-29 Thread Peter Dalgaard
Wolfram Fischer wrote: > What is the reason, that the levels of the factor > returned by cut() are not marked as ordered levels? > > >> is.ordered( cut( breaks=3, sample(10 ) ) ) >> > FALSE > > It would arguably be the Right Thing, but there would be complications in modeling, where orde

Re: [R] OT: P(Z <= -1.46).

2006-11-29 Thread Prof Brian Ripley
In the days when tables were calculated laboriously, it was common practice to introduce several deliberate rounding errors in every table. These were used to catch infringements of copyright (and recover reproduction fees). Because tables came (and probably still do come) from a very few sourc

[R] need help with barplot

2006-11-29 Thread Robertas Kavaliūnas
Hello, I do this a=c(10.2,0.4,0.2,5.2,8.6,1.6,0.0,1.0,6.3,1.4,0.4,0.2) b=matrix(a,nrow=4) rownames(b)=c("20/04/2002","21/04/2002","22/04/2002","23/04/2002") colnames(b)=c("p1","p2","p3") barplot(b,beside=T,col=(c("red","orange","yellow"))) then I have http://www.mif.vu.lt/~roka5178/barplot1.JPG

Re: [R] need help with barplot

2006-11-29 Thread David Barron
You need the transpose of the matrix (or create it differently in the first place!). Changing the last line to > barplot(t(b),beside=T,col=(c("red","orange","yellow"))) should do the trick. On 29/11/06, Robertas Kavaliūnas <[EMAIL PROTECTED]> wrote: > Hello, > I do this > a=c(10.2,0.4,0.2,5.2,8

[R] 1D & 2D response plots from RSM models

2006-11-29 Thread Michael Hopkins
Hello R experts I am looking for: - advice - sample commands - pointers in MASS 4E - packages That help to produce 1D and 2D response plots from quadratic RSM linear regression models that have been produced in R. Let me explain a little what I mean. For 1D plots I mean the variable range (

[R] --max-vsize option

2006-11-29 Thread Daniel Gatti
The R memory docs say that the --*-vsize option takes an integer argument and then 'G', 'M', 'K', or 'k'. When I start R using R --max-vsize=10G I receive the warning: WARNING: --max-vsize=10G=10'M': too large and ignored The system that I'm working on is a 64-bit Sun server with 40G of memo

[R] showing available environment variables

2006-11-29 Thread Karin Lagesen
I have searched through the mailing lists and the docs, and I seem completely unable to find a way to make R list all available environment variables that it uses. The reason that I want to do this is the following: The default program for reading files when using openVignettes on my system is g

[R] Block clustering and largest square block in binary matrix

2006-11-29 Thread Mike White
Hi I have a large binary square matrix (about 2500 x 2500) obtained from a distance matrix on x (smaller simulation below), in which I want to find the largest square block of 1's for all permutations of the rows and columns. I then want to remove the rows and columns corresponding to this block a

[R] String question

2006-11-29 Thread Carmen Meier
Hi to all I would to determinate whether bits is a binary code and I would to find out the which bit is set to 1 bits <-"00110110" I found to detect whether there are only numbers all.digits(bits) but is there any function to detect whether there are only 0 and 1 in the string And how could I g

Re: [R] comma delimiter & comma in tex

2006-11-29 Thread Gabor Grothendieck
Preprocess the file surrounding the last field with quotes. The xx <- line is for purposes of making it self contained here and in reality would be replaced with the commented line above it. It simply reads the text in. The yy <- line then surrounds the fourth field with double quotes assuming a

Re: [R] String question

2006-11-29 Thread Romain Francois
Carmen Meier wrote: > Hi to all > I would to determinate whether bits is a binary code and I would to find > out the which bit is set to 1 > > bits <-"00110110" > I found to detect whether there are only numbers > all.digits(bits) > but is there any function to detect whether there are only 0 and

Re: [R] String question

2006-11-29 Thread John Fox
Dear Carmen, length(grep("[^01]", bits)) == 0 should do the trick, returning TRUE if the string contains only 0's and 1's. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://so

Re: [R] Why the factor levels returned by cut() are not ordered?

2006-11-29 Thread Petr Pikal
On 29 Nov 2006 at 12:08, Peter Dalgaard wrote: Date sent: Wed, 29 Nov 2006 12:08:21 +0100 From: Peter Dalgaard <[EMAIL PROTECTED]> To: Wolfram Fischer <[EMAIL PROTECTED]> Copies to: r-help@stat.math.ethz.ch Subject:R

Re: [R] String question

2006-11-29 Thread Petr Pikal
Hi gregexpr can be used bits <-"0011011aaa0" gregexpr("[01]", bits) [[1]] [1] 1 2 3 4 5 6 7 11 attr(,"match.length") [1] 1 1 1 1 1 1 1 1 or grep("[^01]", bits) if you want to know that there is any other character then 0 or 1 gregexpr("1", bits) if you want to know location of 1's HTH

Re: [R] String question

2006-11-29 Thread Gabor Grothendieck
Try: # TRUE if all 0 and 1 regexpr("^[01]*$", bits) > 0 # positions of 1s gregexpr("1", bits)[[1]] On 11/29/06, Carmen Meier <[EMAIL PROTECTED]> wrote: > Hi to all > I would to determinate whether bits is a binary code and I would to find > out the which bit is set to 1 > > bits <-"00110110" >

Re: [R] need help with barplot

2006-11-29 Thread John Kane
--- Robertas Kavaliûnas <[EMAIL PROTECTED]> wrote: > Hello, > I do this > a=c(10.2,0.4,0.2,5.2,8.6,1.6,0.0,1.0,6.3,1.4,0.4,0.2) > b=matrix(a,nrow=4) > rownames(b)=c("20/04/2002","21/04/2002","22/04/2002","23/04/2002") > colnames(b)=c("p1","p2","p3") > barplot(b,beside=T,col=(c("red","orange","yell

[R] Lmer, P-values and mixed logistic regression

2006-11-29 Thread Julien
Hi I know that p-values doesn't appear anymore in the summary of a linear mixed-model with lmer. However, if I do a mixed logistic regression with lmer using family=binomial, the summary includes a p-values for fixed effects. Is it normal, could I use those p-values to interpret the fixed effect

[R] simple R question

2006-11-29 Thread iqbal hussain
Hi, I am new to this, can anyone help. I am working with matrices, with stocknames as colNames and dates as rowNames. The data coontains percentile ranking for the stocks. Date IBM MSFT 20061122 12 4 20061115 12 4 20061108 12 4 20061101 12 4 20061025 12 4 2006

Re: [R] showing available environment variables

2006-11-29 Thread Gabor Grothendieck
These retrieve and set environment variables: ?Sys.getenv ?Sys.putenv On 11/29/06, Karin Lagesen <[EMAIL PROTECTED]> wrote: > > I have searched through the mailing lists and the docs, and I seem > completely unable to find a way to make R list all available > environment variables that it uses. >

Re: [R] --max-vsize option

2006-11-29 Thread Prof Brian Ripley
On Wed, 29 Nov 2006, Daniel Gatti wrote: > The R memory docs say that the --*-vsize option takes an integer > argument and then 'G', 'M', 'K', or 'k'. When I start R using > > R --max-vsize=10G > > I receive the warning: > > WARNING: --max-vsize=10G=10'M': too large and ignored > > The system tha

Re: [R] building R 2.4.0 on aix

2006-11-29 Thread Eric Harley
Roy and others, I'm also trying to build R 2.4.0 on aix 5 (5.3 in my case, on an Intellistation Power 285) and I have not had luck yet. I notice that the only mentions of AIX on this list in the past two months are people not having luck building it. So far there don't seem to be any responses,

[R] Reformulação do site

2006-11-29 Thread Leticia Spangnolo
Boa tarde, Meu nome é Wesley Alves, sou Designer Interativo há 5 anos visitei o site desta empresa. A principio, achei interessante as informações e a disposições da mesma, mas acredito que posso melhorar ainda mais o web site de vocês,estruturando melhor a parte de design e disposição geral d

Re: [R] Lmer, P-values and mixed logistic regression

2006-11-29 Thread Douglas Bates
On 11/29/06, Julien <[EMAIL PROTECTED]> wrote: > Hi > I know that p-values doesn't appear anymore in the summary of a linear > mixed-model with lmer. However, if I do a mixed logistic regression with > lmer using family=binomial, the summary includes a p-values for fixed > effects. > Is it normal,

[R] Skip NA and alter length

2006-11-29 Thread Syed Abid Hussaini
Hi, This is my first post. Problem: I have a matrix 5 by 5 and it has 3 NAs in them. Now, when i use length () for a particular column which has NA it returns 5. I know this is true, but how do i change my matrix such that the length becomes 5 minus the number of NAs i have. I know NA has a l

Re: [R] showing available environment variables

2006-11-29 Thread Prof Brian Ripley
On Wed, 29 Nov 2006, Karin Lagesen wrote: > > I have searched through the mailing lists and the docs, and I seem > completely unable to find a way to make R list all available > environment variables that it uses. > > The reason that I want to do this is the following: > > The default program for

Re: [R] Skip NA and alter length

2006-11-29 Thread Dimitris Rizopoulos
try this: mat <- matrix(1:25, 5, 5) mat[sample(25, 3)] <- NA # mat colSums(!is.na(mat)) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +

Re: [R] --max-vsize option

2006-11-29 Thread Daniel Gatti
Prof Brian Ripley wrote: > But is this a 64-bit build of R? (Solaris is 32-bit by default.) > R --max-vsize=10G works on 64-bit Solaris build for me, but I get that > (somewhat garbled) message on a 32-bit build. Thanks. That was it. Apparently they had compiled R with 32-bit settings. They

Re: [R] simple R question

2006-11-29 Thread Gabor Grothendieck
Try creating a zoo object from your data frame # data from your post DF <- structure(list(Date = as.integer(c(20061122, 20061115, 20061108, 20061101, 20061025, 20061018, 20061011, 20061004, 20060927)), IBM = as.integer(c(12, 12, 12, 12, 12, 12, 11, 12, 10)), MSFT = as.integer(c(4, 4, 4, 4,

Re: [R] Aggregating data

2006-11-29 Thread David Kaplan
The problem is that this doesn't seem to give what I want. I did look at this. Perhaps doBy will work - haven't tried it yet. But, any other suggestions are much appreciated. === David Kaplan, Ph.D. Professor Department

Re: [R] Skip NA and alter length

2006-11-29 Thread Syed Abid Hussaini
Thanks!! That did solve my problem. I am loving it. --- Dimitris Rizopoulos <[EMAIL PROTECTED]> wrote: > try this: > > mat <- matrix(1:25, 5, 5) > mat[sample(25, 3)] <- NA > # > mat > colSums(!is.na(mat)) > > > I hope it helps. > > Best, > Dimitris > > > Dimitris Rizopoulos > Ph

[R] An example of using rJava

2006-11-29 Thread Jason Liao
I have received a few private emails asking for some simple demonstration of calling Java code from R using the rJava package (which can be installed directly inside R). Here is one example for convolving two vectors (an example in the R manual about linking C with R). First write a Java program

Re: [R] An example of using rJava

2006-11-29 Thread Rajarshi Guha
On Wed, 2006-11-29 at 08:48 -0800, Jason Liao wrote: > I have received a few private emails asking for some simple > demonstration of calling Java code from R using the rJava package > (which can be installed directly inside R). One could also examine the sources of the rcdk package which provides

[R] legend in lattice densityplot

2006-11-29 Thread Albert Vilella
Hi, I have a densityplot like this: x = c(rnorm(100,1,2),rnorm(100,2,4),rnorm(100,3,6)) f = sample(c("A","B","C","D","E"),300,replace=TRUE) df=data.frame(x,f) library(lattice) attach(df) densityplot(~x, groups=f) And I want to add a legend with the colours for the factors. How can I do that? How

Re: [R] legend in lattice densityplot

2006-11-29 Thread Chuck Cleland
Albert Vilella wrote: > Hi, > > I have a densityplot like this: > > x = c(rnorm(100,1,2),rnorm(100,2,4),rnorm(100,3,6)) > f = sample(c("A","B","C","D","E"),300,replace=TRUE) > df=data.frame(x,f) > library(lattice) > attach(df) > densityplot(~x, groups=f) > > And I want to add a legend with the c

[R] random binary trees in R

2006-11-29 Thread Steven Finch
Hello! I wish to generate random binary trees in R. Unfortunately recursive code like: t <- function(p) { list(ifelse(runif(1)https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contain

Re: [R] legend in lattice densityplot

2006-11-29 Thread Albert Vilella
Are this legend colors correlated to the plot? If I do a: densityplot(~x, groups=f, plot.points=FALSE, auto.key=TRUE,col=heat.colors(5)) I get different colors in the legend than the plot... On 11/29/06, Chuck Cleland <[EMAIL PROTECTED]> wrote: > Albert Vilella wrote: > > Hi, > > > > I have a

Re: [R] random binary trees in R

2006-11-29 Thread Uwe Ligges
Steven Finch wrote: > Hello! > > I wish to generate random binary trees in R. > Unfortunately recursive code like: > > t <- function(p) > { >list(ifelse(runif(1) } ifelse() is vectorized and evaluates for both cases! Instead, try: t <- function(p) list(if(runif(1) < p) t(p) else 0,

Re: [R] legend in lattice densityplot

2006-11-29 Thread Gabor Grothendieck
Try specifying it at the par.settings= level since that is where both the plot and the legend get it from: set.seed(1) DF <- data.frame(x = c(rnorm(100,1,2),rnorm(100,2,4),rnorm(100,3,6)), f = sample(c("A","B","C","D","E"),300,replace=TRUE)) library(lattice) densityplot(~ x, DF, groups = f

[R] reshape command is (stats) dropping instances

2006-11-29 Thread Farrel Buchinsky
I would really appreciate it if anyone could determine what is going on with the following command. It is only half-working and is losing lots of data. For the life of me I cannot even see the pattern of what it is losing and what it is not. I am attaching the R data set which you can use with th

Re: [R] legend in lattice densityplot

2006-11-29 Thread Chuck Cleland
Albert Vilella wrote: > Are this legend colors correlated to the plot? They are if you rely on the colors in trellis.par.get("superpose.line")$col If you want different colors you might use trellis.par.set() to temporarily change the colors: x <- c(rnorm(100,-2,1),rnorm(100,0,1),rnorm(100,2

Re: [R] Aggregating data

2006-11-29 Thread David Kaplan
Chuck and others. Here is the problem I need help on. Thanks. I want to follow-up on a question I had a week or so ago. I want to aggregate a very large data set. Generally in a program such as SPSS, one chooses a so-called "break variable" that is the variable, and the

Re: [R] Aggregating data

2006-11-29 Thread Gabor Grothendieck
Using the builtin data set CO2: aggregate(CO2[4:5], CO2[1], mean) calculates the means of variables 4 and 5 based combinations of the levels of variable 1. Is that what you want? On 11/29/06, David Kaplan <[EMAIL PROTECTED]> wrote: > Chuck and others. Here is the problem I need help on.

Re: [R] Aggregating data

2006-11-29 Thread Gabor Grothendieck
I meant: calculates the means of variables 4 and 5 based on the levels of variable 1. Is that what you want? On 11/29/06, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Using the builtin data set CO2: > > aggregate(CO2[4:5], CO2[1], mean) > > calculates the means of variables 4 and 5 based com

Re: [R] Aggregating data

2006-11-29 Thread Doran, Harold
David: Is this what you are looking for? set.seed(10) tmp <- data.frame(group = gl(3,10), something = rnorm(30)) with(tmp, tapply(something, group, mean)) 1 2 3 -0.4906568 0.3695915 -0.9129640 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAI

[R] filled.contour and NA's

2006-11-29 Thread antonio rodriguez
Hi, I'm trying to do a filled.contour plot where some points are labelled as NA. How do I could plot this kind of graphics, so NA points are coloured black, keeping the levels of remaining points. NA's values represent land points (meaningless), and what I want to plot is the levels of a vari

Re: [R] Aggregating data

2006-11-29 Thread Chuck Cleland
David Kaplan wrote: > Chuck and others. Here is the problem I need help on. Thanks. > > > > I want to follow-up on a question I had a week or so ago. I want to > aggregate a very large data set. Generally in a program such as SPSS, > one chooses a so-called "break varia

[R] matrix comparison, and cbind issues.

2006-11-29 Thread H. Paul Benton
Hello, This should be a fairly simple question. I have 2 matrix's and I want to get the difference between them and then remove the difference from one of them. So A vs B, anything I see in B I want to remove from A, and then print out the final matrix. I have some code here but at the moment I'm

Re: [R] showing available environment variables

2006-11-29 Thread Gregor Gorjanc
Karin Lagesen medisin.uio.no> writes: ... > The default program for reading files when using openVignettes on my > system is ggv. ggv is broken. I would therefore like to use a > different program, and I found the variable R_PDFVIEWER which should > do the trick. However, so far no luck. > > Ther

Re: [R] Aggregating data

2006-11-29 Thread Chuck Cleland
Actually, I think this is a much better variation on Gabor's excellent example: library(nlme) aggregate(Orthodont[c("distance","age")], by = list(Subject = Orthodont["Subject"]), FUN =mean) Chuck Cleland wrote: > David Kaplan wrote: >> Chuck and others. Here is the problem I need help on. Than

Re: [R] matrix comparison, and cbind issues.

2006-11-29 Thread H. Paul Benton
Mark, A and B will probably be different sizes. Won't 'C<-A-B' just do the subtraction of matrix A by matrix B? So What I was thinking was that it would find 2 numbers one at position 6 and the other at position 9. If it finds roughtly these numbers in matrix B then it will identify this

[R] control for frame color in cloud()

2006-11-29 Thread Eric Peterson
I am trying to construct a cloud plot viewable in 3D with the classic 3D glasses (one red lens, one bluish lens). I've figured out how to overlay two printings of cloud() (from the lattice package) with appropriate colors, however the box frame seems to only print in black. Is there any way to co

[R] Dummies multiplied with other variable

2006-11-29 Thread Andreas Goesele
Hi, I would like to estimate something like y = a + b*d2*y + c*d3*y where the dummies are created from some vector d with three (actually many more) levels using factor(). But either there is included the variable y or d1*y. How could I get rid of these? Example: x = c(1,2,3,4,5,6,7,8) y = c(3,6

Re: [R] Dummies multiplied with other variable

2006-11-29 Thread David Barron
Is this what you want? lm(y ~ fd + fd:y) On 29/11/06, Andreas Goesele <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to estimate something like y = a + b*d2*y + c*d3*y where > the dummies are created from some vector d with three (actually many > more) levels using factor(). But either there i

[R] How to solve differential equations with a delay (time lag)?

2006-11-29 Thread Ravi Varadhan
Hi, I would like to solve a system of coupled ordinary differential equations, where there is a delay (time lag) term. I would like to use the "lsoda" function "odesolve" package. However, I am not sure how to specify the delay term using the syntax allowed by odesolve. Here is an example

[R] problem with indexing a zoo object

2006-11-29 Thread Leeds, Mark \(IED\)
My problem is the following : I create 2 zoo objects and then I try to subset one of them using logic. indicesthatpass is a vector of trues and falses but when I send it into bckret, it returns an empty bckret. Obviously it has something to do with bckret being a zoo object and if I do the same sub

[R] packages about discriminant analysis

2006-11-29 Thread Feng Qiu
Hi guys: I'm testing some statistic discriminant analysis methods in R. But I couldn't find the package for these methods: 1. Discriminant analysis implemented with nearest neighbor method, 2. logistic discriminant analysis 3. POLYCLASS algorithm( there

[R] better define: matrix comparison and cbind issue

2006-11-29 Thread H. Paul Benton
Hello, Sorry to all for the lack of communication, and thanks to those with the suggestions. So I have two matrixes which are different sizes, same column number but different row number. What I would like to do is to compare A to B. In the 6 and 9th column there are ref numbers (molecular mass

Re: [R] problem with indexing a zoo object

2006-11-29 Thread Achim Zeileis
On Wed, 29 Nov 2006, Leeds, Mark (IED) wrote: > My problem is the following : I create 2 zoo objects and then I try to > subset one of them using logic. indicesthatpass is a vector of trues and Nope, it's a matrix (because you want the coredata to be a matrix) but should be a vector. (Maybe we co

Re: [R] How to solve differential equations with a delay (time lag)?

2006-11-29 Thread Ravi Varadhan
Hi, I would like to add an additional piece of information to my previous posting: y[1](t) = 0, for all t in the interval (-delay, 0) This completes the specification of the problem. Thanks, Ravi. --- Ravi Varadh

Re: [R] control for frame color in cloud()

2006-11-29 Thread Deepayan Sarkar
On 11/29/06, Eric Peterson <[EMAIL PROTECTED]> wrote: > I am trying to construct a cloud plot viewable in 3D with the classic 3D > glasses (one red lens, one bluish lens). I've figured out how to overlay > two printings of cloud() (from the lattice package) with appropriate colors, > however the b

[R] tests for NULL objects

2006-11-29 Thread Benilton Carvalho
Hi Everyone, After searching the subject and not being successful, I was wondering if any you could explain me the idea behind the following fact: all(NULL == 2) ## TRUE any(NULL == 2) ## FALSE Thanks a lot, Benilton -- Benilton Carvalho PhD Candidate Department of Biostatistics Johns Hopki

Re: [R] How to solve differential equations with a delay (time lag)?

2006-11-29 Thread Setzer . Woodrow
lsoda does not solve delay differential equations, which is what you need to be able to do. A quick search on netlib (netlib.org) turned up one match for "delay differential equations": ode/ddverk.f, which might help (though not in R). R. Woodrow Setzer, Ph. D. National Center for Computational T

[R] Removing terms from formula

2006-11-29 Thread McGehee, Robert
R-help, Given a simple linear model, say lm(x ~ y + z), I would like to remove model terms that are factors with only one level. Thus, if 'z' were a factor with only one level, lm(x ~ y + z) becomes lm(x ~ y + 1). Likewise, if both 'y' and 'z' are one-level factors, then the resulting calculation i

Re: [R] better define: matrix comparison and cbind issue

2006-11-29 Thread H. Paul Benton
Ok so something like this. A 1 2 3 4 5 A v w x z G x z y w C y v z x D x v w z B 1 2 3 4 5 F z x y z D x z w v E x z w v So here I would just be comparing col 1. I would compare A[1,] to B[1,] and then I would see that A[1,4] has the same element as B[1,2], so I would remove A[,4]. Making A: A

[R] strptime - %p format doesn't seem to be working

2006-11-29 Thread Edward Abraham
Hi there, Am I missing something? The "%p" format, which should match against AM/PM, seems to be broken in R 2.3.1 running on Windows XP SP2. For example, the following fails > strptime("10AM", "%I%p") [1] NA whereas the this works as you would expect, but is ambiguous > strptime("10", "%I

Re: [R] Dummies multiplied with other variable

2006-11-29 Thread Andreas Goesele
"David Barron" <[EMAIL PROTECTED]> writes: > Is this what you want? > > lm(y ~ fd + fd:y) Thanks for you fast reply. But it's not what I wanted. To make it clearer I have to correct the first part of what I wrote: > On 29/11/06, Andreas Goesele <[EMAIL PROTECTED]> wrote: >> I would like to est

Re: [R] How to solve differential equations with a delay (time lag)?

2006-11-29 Thread Ravi Varadhan
Thanks, Woodrow. I also found a DDE solver called "dde23" in Matlab written by L.F. Shampine. I will see if I can use it in Scilab, since I don't have Matlab. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor,

[R] Problem with PPC packages on Intel Mac

2006-11-29 Thread Michael Hopkins
Hi all I have recently moved to an Intel Mac and installed the latest R (2.4.0) but I am having trouble with a number of packages. When I try to load them I often get the following message: Error: package 'pspline' was built for powerpc-apple-darwin6.8 I have tried to update all the packa

Re: [R] tests for NULL objects

2006-11-29 Thread Bert Gunter
Merely convention. NULL == 2 <==> logical(0), that is, a logical vector of length 0. It makes sense (at least to me) that any(logical(0)) is FALSE, since no elements of the vector are TRUE. all(logical(0)) is TRUE since no elements of the vector are FALSE. I think these are reasonable and fairly

Re: [R] reshape command is (stats) dropping instances

2006-11-29 Thread Farrel Buchinsky
The attached file never went through. How does one attach a R workskpace (or two dataframes) "Farrel Buchinsky" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I would really appreciate it if anyone could determine what is going > on with the following command. It is only half-workin

Re: [R] ML fit of gamma distribution to grouped data

2006-11-29 Thread Augusto.Sanabria
Thomas, The Gamma distr. can be fitted via ML using: Library("MASS") GF <- fitdistr(given_data,"gamma") sh <- GF$estimate[1] ra <- GF$estimate[2] Fitting via Moments, m: var <- m[2] - m[1]*m[1] sh <- m[1]*m[1]/var sc <- m[1]/var ra <- 1/sc G_pdf <- dgamma(breaks,shape=sh,rate=ra,scale=1/ra) H

Re: [R] tests for NULL objects

2006-11-29 Thread Martin Morgan
Bert Gunter <[EMAIL PROTECTED]> writes: > Merely convention. There's a similar thread in the R-devel newgroup about 'prod(numeric(0)) surprise' started by Ben Bolker, 09 Jan 2006, (https://stat.ethz.ch/pipermail/r-devel/2006-January/036041.html) and the post by Andy Liaw (https://stat.ethz.ch/pip

Re: [R] tests for NULL objects

2006-11-29 Thread Benilton Carvalho
Thank you Bert, Sorry if it sounded like a complain, this is not what I meant. The situation I had was: given a vector "v" containing integers or NA's, I wanted to know if after excluding the NA's all the remaining observations were 2's. Naively, I assumed that: all(na.omit(v) == 2) would

Re: [R] tests for NULL objects

2006-11-29 Thread Benilton Carvalho
On Nov 29, 2006, at 7:54 PM, Martin Morgan wrote: >> http://en.wikipedia.org/wiki/Empty_set >> which says, in part: >> Operations on the empty set > <...> > 'any' is like 'sum', 'all' is like 'prod'. > > Martin Thank you very much Martin. It's clear now. Benilton _

Re: [R] better define: matrix comparison and cbind issue

2006-11-29 Thread H. Paul Benton
Ok, so columns are fixed and my apologizes, for the incorrect subscripting. So I have the matching down because I'm matching a number so I've used an if statement with some fuzz. At the moment my code from my earlier post gets me a long vector with the data in it but not a nice matrix that is reada

Re: [R] better define: matrix comparison and cbind issue

2006-11-29 Thread Leeds, Mark \(IED\)
Paul : I haven't tested this but try it and let me know. Let x be the # of the col in A and y be the # of the column in B. colinA<-A[,x] colinB<-B[,y] matchingrows<-B[(colinB %in% colinA),colinB] C<-A[-1.0*c(matchingrows),] I think C should be the resulting matrix that you want but it's untest

Re: [R] better define: matrix comparison and cbind issue

2006-11-29 Thread jim holtman
Is this what you want? > A <- read.table(textConnection("A v w x z + G x z y w + C y v z x + D x v w z + "), as.is=T) > > B <- read.table(textConnection("F z x y z + D x z w v + E x z w v + "), as.is=T) > > A V1 V2 V3 V4 V5 1 A v w x z 2 G x z y w 3 C y v z x 4 D x v w z > B

Re: [R] better define: matrix comparison and cbind issue

2006-11-29 Thread H. Paul Benton
Jim, Is there a way to make match fuzzy? I had a look at ?match but couldn't see anything about it so I thought I would as the guru. Also can I do something like index <- is.na(match(A[,1 & 2], B[,1 & 2])) ? > index <- is.na(match(A[,1 & 2], B[,1 & 2])) > index [1] TRUE TRUE TRUE TRUE TRU

Re: [R] better define: matrix comparison and cbind issue

2006-11-29 Thread H. Paul Benton
So I guess I was thinking like a fuzzy if. I'm matching a number in my matrix and I would like to see if the numbers are the same to 0.1 accuracy. So in an if statement I would do something like: if(any((A[i,6] - B[j,6]) <= 0.1)) is this possible with match? Sorry for my lack of R knowledge.

Re: [R] problem with the plm package (2)

2006-11-29 Thread Spencer Graves
I haven't seen any replies to this, so I will offer some suggestions even though I'm not familiar with 'plm'. 1. The standard formula syntax in S-Plus and R is that "y ~ x" is a request to estimate b0 and b1 in y = b0+b1*x+error. Since this already includes "1", it is essentially

Re: [R] tests for NULL objects

2006-11-29 Thread Charilaos Skiadas
On Nov 29, 2006, at 7:58 PM, Benilton Carvalho wrote: > But that's okay, just a matter of adding an extra test (already done). > I'm guessing it would be something like: all(is.na(v) | v==2) > When I asked for clarification about the reasons for this, I assumed > that: > if all(v) is TRUE ==> any(

Re: [R] error in latex() : n.group : RESOLVED

2006-11-29 Thread Ben
that was trivial and logical ... You just have to download the source from the repository and then use the function source() with it in your script ... 2006/11/24, Ben <[EMAIL PROTECTED]>: > > When I was running the function latex() I got an error about a not found > object : n.rgroup ... > > I

Re: [R] packages about discriminant analysis

2006-11-29 Thread Prof Brian Ripley
On Wed, 29 Nov 2006, Feng Qiu wrote: > Hi guys: > I'm testing some statistic discriminant analysis methods in R. > But I couldn't find the package for these methods: Where have you been looking? MASS (the book) has the first two of these, and using search.r-project.org would also give

Re: [R] Removing terms from formula

2006-11-29 Thread Gabor Grothendieck
Do you really want the 1? Normally the intercept is not explicitly given unless there are no other terms in the formula so assuming you only want it if you have otherwise removed all the variables then: zap1 <- function(fo) { L <- sapply(all.vars(fo[[length(fo)]]), function(x) nlevels(ge

Re: [R] Removing terms from formula

2006-11-29 Thread Gabor Grothendieck
One correction (to the get): Do you really want the 1? Normally the intercept is not explicitly given unless there are no other terms in the formula so assuming you only want it if you have otherwise removed all the variables then: zap1 <- function(fo) { L <- sapply(all.vars(fo[[length(fo)]])

Re: [R] strptime - %p format doesn't seem to be working

2006-11-29 Thread Prof Brian Ripley
On Thu, 30 Nov 2006, Edward Abraham wrote: > Hi there, > > Am I missing something? The "%p" format, which should match against > AM/PM, seems to be broken in R 2.3.1 running on Windows XP SP2. For > example, the following fails > > > strptime("10AM", "%I%p") > [1] NA > > > whereas the this works

[R] R_WinEdt question

2006-11-29 Thread Aimin Yan
if I want to put fig1plot to the left, figYPplot to the right figYAaplot on the bottom. How to modify the following cod to do these? \begin{figure}[H] \centering \begin{minipage}[t]{0.5\textwidth} \centering <>= <> @ %\caption{Caption 1} \end{minipage} \begin{minipage}[t]{0.5\textwidth} \centeri