Re: [R] building a data.frame from a matrix: preventing conversion to factors

2007-11-13 Thread Prof Brian Ripley
On Wed, 14 Nov 2007, Christian Gold wrote: > Thanks for your reply. I have tried the reproducible example you have > provided (thanks!) in 3 different versions of R, and get what you get in R > version 2.5.1, but in 2.3.1 (which I normally use) and 2.1.0 (which I still > have installed) I get f

[R] Is there any document explaining the pararell regression detailly ?

2007-11-13 Thread leffgh
I don't understand the output from a pararell regression , I don't know how to extract components of the result . can anyone send me files explaining the pararell regression detailly ? I will be very grateful to you -- View this message in context: http://www.nabble.com/Is-there-any-document-ex

Re: [R] building a data.frame from a matrix: preventing conversion to factors

2007-11-13 Thread Christian Gold
Thanks for your reply. I have tried the reproducible example you have provided (thanks!) in 3 different versions of R, and get what you get in R version 2.5.1, but in 2.3.1 (which I normally use) and 2.1.0 (which I still have installed) I get factors. I guess this means I should switch to the ne

Re: [R] combine two dataframe

2007-11-13 Thread Denver XU
try this x<-c(1,2,3,2,3,1,1,3,2) A<-matrix(x,3,3,byrow=T) B<-matrix(c(1,2,2,1),2,2) A1<-matrix(rep(A,each=2),6,3) B1<-rbind(B,B,B) data.frame(A1,B1) X1 X2 X3 X1.1 X2.1 1 1 2 312 2 1 2 321 3 2 3 112 4 2 3 121 5 1 3 212 6 1 3 221

Re: [R] connection diagram

2007-11-13 Thread Manal Helal
Hi elijah Thank you again very much, the case I am having is simple data like the following: NodetotalOutgoing link1 link2 1 2 2 3 2 2 4 5 3 2 5 6 4 2 7 8 5 2 8 9 6 2 9 10 7

Re: [R] plotting coxph results using survfit() function

2007-11-13 Thread Stephen Weigand
On Nov 13, 2007 5:53 AM, Shoaaib Mehmood <[EMAIL PROTECTED]> wrote: > i want to make survival plots for a coxph object using survfit > function. mod.phm is an object of coxph class which calculated results > using columns X and Y from the DataFrame. Both X and Y are > categorical. I want survival

Re: [R] cronbach's alpha

2007-11-13 Thread Jeff Miller
Try cronbach in the psy package Regarding your other question, see classic web reference below. http://www.ats.ucla.edu/STAT/SPSS/library/negalpha.htm Also, note Harold Doran's explanation from a similar R listserv post back in January http://tolstoy.newcastle.edu.au/R/e2/help/07/01/9125.html

Re: [R] cronbach's alpha

2007-11-13 Thread Chung-hong Chan
alpha.scale (psych) cronbach (multilevel) On Nov 14, 2007 7:33 AM, raymond chiruka <[EMAIL PROTECTED]> wrote: > hie > 1...i'm trying to carryout a relibility testusing cronbach's alpha what > fuctin do i use. > > 2.. this is more of a statistical question.if the alpha value for all > th

Re: [R] suppress y-axis in a dotplot (lattice)

2007-11-13 Thread Deepayan Sarkar
On Nov 13, 2007 10:28 PM, Daniel Malter <[EMAIL PROTECTED]> wrote: > Hi, > > I want to illustrate when individuals had an event over time. I am using > dotplot from the lattice library. The plot itself works well, but as I have > many individuals, the labels on the y-axis for these individuals over

Re: [R] FW: Reference category for explanatory factors

2007-11-13 Thread Jason Ferris
Dear Brian, Thanks for your prompt response. I had tried both 'relevel' and 'reorder' preg_fyear5a.msm<-msm(outcome~ipi, subject=id, data, qmatrix=crudemat, exacttimes=TRUE, covariates=~factor(relevel(year5a),1)) preg_fyear5a.msm<-msm(outcome~ipi, subject=id, data, qmatrix=crudemat, exacttimes=T

Re: [R] ggplot2: changing axis labels in ggplot()

2007-11-13 Thread hadley wickham
On Nov 13, 2007 7:23 PM, James D Forester <[EMAIL PROTECTED]> wrote: > > > hadley wrote: > > > > > > That's from a previous version, now you need to do: > > > > p + scale_x_continuous("Predictor") + scale_y_continuous("Response") > > > > (or scale_x_discrete if discrete) > > > > > > Thanks Hadley -

Re: [R] ggplot2: changing axis labels in ggplot()

2007-11-13 Thread James D Forester
hadley wrote: > > > That's from a previous version, now you need to do: > > p + scale_x_continuous("Predictor") + scale_y_continuous("Response") > > (or scale_x_discrete if discrete) > > Thanks Hadley -- that worked fine. However, I just noticed that when I try to add an abline to this plo

Re: [R] logistic regression model specification

2007-11-13 Thread Emmanuel Charpentier
Pardon me for intruding, but I had recently to explain something analogous to this to a distinguished physician who had hurt himself playing with survival models and was bleeding graphs and analyses all over the place... Dylan Beaudette a écrit : > On Tuesday 13 November 2007, Prof Brian Ripley wr

Re: [R] logistic regression model specification

2007-11-13 Thread Dylan Beaudette
On Tuesday 13 November 2007, Peter Dalgaard wrote: > Prof Brian Ripley wrote: > > On Tue, 13 Nov 2007, Dylan Beaudette wrote: > >> Hi, > >> > >> I have setup a simple logistic regression model with the glm() function, > >> with the follow formula: > >> > >> y ~ a + b > >> > >> where: > >> 'a' is a

Re: [R] TRUNCATED error with data frame

2007-11-13 Thread Julian Burgos
Hi Amit, Please read carefully the Mailing List Posting Guide (available at http://www.r-project.org/posting-guide.html). In particular, this section: "For new subjects, compose a new message and include the '[EMAIL PROTECTED]' (or '[EMAIL PROTECTED]') address specifically. (Replying to an ex

Re: [R] time plotting problem

2007-11-13 Thread hadley wickham
Here's a version using reshape and ggplot: mydata <- read.table("http://ca.geocities.com/jrkrideau/R/heartdata.txt";, sep="\t", header=FALSE) mydata[,1] <- as.Date(mydata[,1],"%m/%d/%y") names(mydata) <- c("dates", "sy","dys","pulse", "weight") molten <- melt(mydata, m = c("sy", "dys")) qplot(da

Re: [R] ggplot2: changing axis labels in ggplot()

2007-11-13 Thread hadley wickham
On Nov 13, 2007 4:30 PM, James D Forester <[EMAIL PROTECTED]> wrote: > > Hi all, > > For various reasons, I need to use ggplot instead of qplot for a complex > figure. Everything is working fine, except I cannot figure out how to rename > the axis labels in ggplot. I have pasted a simple example be

Re: [R] logistic regression model specification

2007-11-13 Thread Peter Dalgaard
Prof Brian Ripley wrote: > On Tue, 13 Nov 2007, Dylan Beaudette wrote: > > >> Hi, >> >> I have setup a simple logistic regression model with the glm() function, with >> the follow formula: >> >> y ~ a + b >> >> where: >> 'a' is a continuous variable stratified by >> the levels of 'b' >> >> >> Lo

Re: [R] TRUNCATED error with data frame

2007-11-13 Thread apsawant
Hi , I am trying to modify the same example script to calculate AOV. Below is the script file (aov.R) I am trying to execute: aov.R -- data1<-c(49,47,46,47,48,47,41,46,43,47,46,45,48,46,47,45,49,44,44,45,42,45,45,40 ,49,46,47,45,49,45,41,43,44,46,45,40,45,43,44,45,48,46,40,45,40,45,47,40) ma

Re: [R] map - mapproj : problem of states localisation

2007-11-13 Thread Ray Brownrigg
Unfortunately, your code is not self-contained. Please provide a completely self-contained set of commands which illustrate the problem (as described in the posting guide). If you mean a problem that the boundaries don't quite line up, as illustrated by: map("france") map("world", col=2, add=T)

[R] cronbach's alpha

2007-11-13 Thread raymond chiruka
hie 1...i'm trying to carryout a relibility testusing cronbach's alpha what fuctin do i use. 2.. this is more of a statistical question.if the alpha value for all the variables is negative what does it mean. and if the alpha value is negative for all tyha variables but is greate

Re: [R] time plotting problem

2007-11-13 Thread Gabor Grothendieck
You can get a slightly better X axis by converting your Date variable to chron: Replace this: plot(mydata[,1], ...) with this: library(chron) plot(chron(unclass(mydata[,1])), ...) and ignore the warning. On Nov 13, 2007 9:08 AM, John Kane <[EMAIL PROTECTED]> wrote: > I clearly spok

Re: [R] Getting mean in a dataframe

2007-11-13 Thread James D Forester
Gang Chen-3 wrote: > > Sorry to hijack this thread. I have a similar but slightly different > situation. Using the original poster's example, how to elegantly get > the mean of column V2 when column V1 is either A or C and F1 is 0? > > I am not sure if this is elegant, but it works: a=me

Re: [R] update matrix with subset of it where only row names match

2007-11-13 Thread jim holtman
Lets take a look at your solution: > mat1 <- matrix(0, nrow=10, ncol=3) > dimnames(mat1) <- list(paste('row', 1:10, sep=''), LETTERS[1:3]) > mat2 <- matrix(1:3, ncol=1, dimnames=list(c('row3', 'row7', 'row5'), "B")) > mat2 B row3 1 row7 2 row5 3 > mat1[rownames(mat2)%in%rownames(mat1),"B"]=ma

[R] Difficult to set a quiet formula in maanova

2007-11-13 Thread Marcelo Laia
Hi, I am trying to run an analysis with the package maanova and I am not getting success. I suppose that I am wrong on set up the formula, so the issue may not be related to R, properly. I have two varieties of plants (V1 and V2). A group of each ones were treated and another was not treated. Af

Re: [R] logistic regression model specification

2007-11-13 Thread Dylan Beaudette
On Tuesday 13 November 2007, Prof Brian Ripley wrote: > On Tue, 13 Nov 2007, Dylan Beaudette wrote: > > Hi, > > > > I have setup a simple logistic regression model with the glm() function, > > with the follow formula: > > > > y ~ a + b > > > > where: > > 'a' is a continuous variable stratified by >

[R] ggplot2: changing axis labels in ggplot()

2007-11-13 Thread James D Forester
Hi all, For various reasons, I need to use ggplot instead of qplot for a complex figure. Everything is working fine, except I cannot figure out how to rename the axis labels in ggplot. I have pasted a simple example below. Any ideas on what I am doing wrong? Thanks for your help. James libra

[R] suppress y-axis in a dotplot (lattice)

2007-11-13 Thread Daniel Malter
Hi, I want to illustrate when individuals had an event over time. I am using dotplot from the lattice library. The plot itself works well, but as I have many individuals, the labels on the y-axis for these individuals overlap. So the y-axis is unreadable. Therefore, I want to suppress the labels o

[R] Getting mean in a dataframe

2007-11-13 Thread Gang Chen
Sorry to hijack this thread. I have a similar but slightly different situation. Using the original poster's example, how to elegantly get the mean of column V2 when column V1 is either A or C and F1 is 0? Thanks, Gang On Nov 13, 2007, at 5:30 AM, Petr PIKAL wrote: > Hi > > [EMAIL PROTECTED]

Re: [R] logistic regression model specification

2007-11-13 Thread Prof Brian Ripley
On Tue, 13 Nov 2007, Dylan Beaudette wrote: > Hi, > > I have setup a simple logistic regression model with the glm() function, with > the follow formula: > > y ~ a + b > > where: > 'a' is a continuous variable stratified by > the levels of 'b' > > > Looking over the manual for model specification,

Re: [R] Cleaning database: grep()? apply()?

2007-11-13 Thread jim holtman
Here is how to wittle it down for the first two parts of your question. I am not exactly what you are after in the third part. Is it that you want specific DATEs or do you want the ratio of the DATE[max]/DATE[min]? > x <- read.table(textConnection("CODENAME

[R] Yet Another Image Format: tikz/pgf

2007-11-13 Thread Scionforbai
Hello R-gurus, my research on archives gave on only result for the following query: is there a way to output images (graphs) in not-buggy pgf or tikz format? I only know the rgl package to do that, but pgf output is buggy (say, I did't find the way to compile into a latex article the pgfpicture r

[R] logistic regression model specification

2007-11-13 Thread Dylan Beaudette
Hi, I have setup a simple logistic regression model with the glm() function, with the follow formula: y ~ a + b where: 'a' is a continuous variable stratified by the levels of 'b' Looking over the manual for model specification, it seems that coefficients for unordered factors are given 'aga

Re: [R] update matrix with subset of it where only row names match

2007-11-13 Thread Martin Waller
jim holtman wrote: > Here is one way of doing it that uses the row and column names: > >> # create test data >> mat1 <- matrix(0, nrow=10, ncol=3) >> dimnames(mat1) <- list(paste('row', 1:10, sep=''), LETTERS[1:3]) >> mat2 <- matrix(1:3, ncol=1, dimnames=list(c('row3', 'row7', 'row5'), "B")) >> ma

[R] Splines and piecewise polynomials

2007-11-13 Thread Christopher J. Ruwe
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dear R-Users! I am trying to fit a spline to a time-series with about 90 values. I would like to specify about four to five knots and I would like the values returned to be similar in fashion to the output of interpSpline - I would only like the sp

Re: [R] time plotting problem

2007-11-13 Thread jim holtman
I have had some problems with dates on axis in certain ranges. Here is a version of axis.POSIXct that I have been using that seems to do a better job: my.axis.POSIXct <- function (side, x, format, inc) { .diff <- diff(range(unclass(x), na.rm = TRUE)) if (.diff < 30) { .by <- "sec

Re: [R] How to count the number of sequences in matrix?

2007-11-13 Thread James W. MacDonald
Hi Lauri, A quick hack: a <- lapply(g, 1, rle) b <- sapply(a, function(x), x[[1]][x[[2]] == 1]) d <- cbind(rep(1:length(b), sapply(b, length)), rep(sapply(b, length), sapply(b, length)), unlist(b)) Best, Jim Lauri Nikkinen wrote: > Hi R-users, > > I have a matrix si

Re: [R] building a data.frame from a matrix: preventing conversion to factors

2007-11-13 Thread Prof Brian Ripley
I am trying to build a data.frame from some vectors and some matrices and seem to be unable to find out how to do this without converting everything to factors. I can prevent conversion of the vectors by using I(), as explained in help(data.frame). However, this doesn't help with the matrices: if I

Re: [R] question about glm behavior

2007-11-13 Thread Emmanuel Charpentier
Yip a écrit : > Hello, > > I was trying a glm fitting (as shown below) and I got a warning and a fitted > residual deviance larger than the null deviance. Is this the expected > behavor of glm? I would expect that even though the warning might be > warranted I should not get worse fitting with an

Re: [R] question about glm behavior

2007-11-13 Thread Prof Brian Ripley
On Tue, 13 Nov 2007, Yip wrote: > I was trying a glm fitting (as shown below) and I got a warning and a > fitted residual deviance larger than the null deviance. Is this the > expected behavor of glm? It can be. One of two things is going on here: A) There is complete separation between the c

Re: [R] a repetition of simulation

2007-11-13 Thread Julian Burgos
Well, the obvious (but perhaps not the most elegant) solution is put everything in a loop and run it 600 times. coefficients=matrix(NA,ncol=3,nrow=600) for (loop in 1:600){ [all your code here] coefficients[loop,]=coef(log_v) } That will give you a matrix with the coefficients of each model

Re: [R] Discrimination of almost-random time series

2007-11-13 Thread Earl F. Glynn
"Hans Werner Borchers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've got some time series representing measurements from a physical > process, like atomic decay data. These time series look almost > random, but should hopefully be distinguishable as they were taken > under dif

Re: [R] a repetition of simulation

2007-11-13 Thread sigalit mangut-leiba
Thank you, I changed that and it's much more efficient. Sigalit. On 11/13/07, Phil Spector <[EMAIL PROTECTED]> wrote: > > You can use the replicate function to do your simulation. First, > put the code to do one repetition in a function: > > dosim0 = function(n=500){ > x <- 0 > y <- 0 > z

Re: [R] How can I fitting this function from values.

2007-11-13 Thread Rolf Turner
On 13/11/2007, at 8:54 PM, Frede Aakmann Tøgersen wrote: > R is case sensitive ;-) so in your list of start values you must > have B=3 and not b=3. Duhh!!! Typo. > Perhaps you have an object named b of a different length than your > data somewhere giving rise to your error messa

Re: [R] a repetition of simulation

2007-11-13 Thread sigalit mangut-leiba
I want to repeat the simulation 600 times and to get a vector of 600 coefficients for every covariate: aps and tiss. Sigalit. On 11/13/07, Julian Burgos <[EMAIL PROTECTED]> wrote: > > And what is your question? > > Julian > > sigalit mangut-leiba wrote: > > Hello, > > I have a simple (?) simulati

[R] Cleaning database: grep()? apply()?

2007-11-13 Thread Jonas Malmros
Dear R users, I have a huge database and I need to adjust it somewhat. Here is a very little cut out from database: CODENAME DATE DATA1 4813ADVANCED TELECOM19870.013 3845ADVANCED THERAPEUTIC SYS LT

[R] question about glm behavior

2007-11-13 Thread Yip
Hello, I was trying a glm fitting (as shown below) and I got a warning and a fitted residual deviance larger than the null deviance. Is this the expected behavor of glm? I would expect that even though the warning might be warranted I should not get worse fitting with an additional covariate in t

[R] need help with error message:Error in lm.fit(design, t(M)) : incompatible dimensions

2007-11-13 Thread Manisha Brahmachary
Hello, I am trying to run a code (see reference section) and when I run the line: fit<-lmFit(xen1dataeset,design), I get the error message: Error in lm.fit(design, t(M)) : incompatible dimensions I will really appreciate if someone can help me understand this error message and possibl

Re: [R] Query an Access database based on a date attribute (Tudor Bodea)

2007-11-13 Thread Prof Brian Ripley
On Tue, 13 Nov 2007, Baize, Harold wrote: > Tudor Bodea asked: > >> In this context, I try to get all the records for which market is atl-bos, >> competitor is delta and dd is 2007-11-20 (first record above). To do this I >> used > >>> # channel <- odbcConnectAccess("test.mdb") >>> res <- sqlQuer

Re: [R] Query an Access database based on a date attribute (Tudor Bodea)

2007-11-13 Thread Emmanuel Charpentier
Baize, Harold a écrit : > Tudor Bodea asked: > >> In this context, I try to get all the records for which market is atl-bos, >> competitor is delta and dd is 2007-11-20 (first record above). To do this I >> used > >>> # channel <- odbcConnectAccess("test.mdb") >>> res <- sqlQuery(channel, "selec

[R] building a data.frame from a matrix: preventing conversion to factors

2007-11-13 Thread Christian Gold
Dear all: I am trying to build a data.frame from some vectors and some matrices and seem to be unable to find out how to do this without converting everything to factors. I can prevent conversion of the vectors by using I(), as explained in help(data.frame). However, this doesn't help with the mat

Re: [R] a repetition of simulation

2007-11-13 Thread Julian Burgos
And what is your question? Julian sigalit mangut-leiba wrote: > Hello, > I have a simple (?) simulation problem. > I'm doing a simulation with logistic model and I want to reapet it 600 > times. > The simulation looks like this: > > z <- 0 > x <- 0 > y <- 0 > aps <- 0 > tiss <- 0 > for (i in 1:5

Re: [R] factors levels ?

2007-11-13 Thread Julian Burgos
What you are looking for is the findInterval() function. Julian W Eryk Wolski wrote: > Hi, > > It's just some example code.. The application is uninteresting. I am > searching for some functionality. > > X <- rnorm(100) //my data > > Y <- seq(-3,3,by=0.1) // bin boundaries. > > Now I would li

Re: [R] cbind function

2007-11-13 Thread Jens Oehlschlägel
And here is a second solution, that differs in what happens if the variables have differing lengths: > var1 <- 1:4 > var2 <- 1:3 > sapply(ls(patt="^var[0-9]"), get) $var1 [1] 1 2 3 4 $var2 [1] 1 2 3 > do.call("cbind", lapply(ls(patt="^var[0-9]"), get)) [,1] [,2] [1,]11 [2,]2

Re: [R] combine two dataframe

2007-11-13 Thread Gabor Grothendieck
Try this: > A <- data.frame(a1 = c(1, 2, 1), a2 = c(2, 3, 3), a3 = c(3, 1, 2)) > B <- data.frame(b1 = 1:2, b2 = 2:1) > > library(sqldf) > sqldf("select * from A, B") a1 a2 a3 b1 b2 1 1 2 3 1 2 2 1 2 3 2 1 3 2 3 1 1 2 4 2 3 1 2 1 5 1 3 2 1 2 6 1 3 2 2 1 On Nov 13,

Re: [R] cbind function

2007-11-13 Thread Henrique Dallazuanna
Try this: sapply(ls(patt="^var[0-9]"), get) On 13/11/2007, livia <[EMAIL PROTECTED]> wrote: > > Hello everyone, > > I would like to use the "cbind" function to construct a dataset, combining > some variable I defined before. > The codes are something like > > var1 <- ... > var2 <- ... > var2 <- .

Re: [R] R - lme

2007-11-13 Thread S Ellison
Divaker, Thanks for the data. For me, > summary(aov(Purity~Supplier/Batch, process)) gives exactly the same results for mean squares as > aov(Purity~Supplier+Error(Supplier/Batch), process) except that the latter gives no p-values (because Supplier appears as both error term and fixed effect, th

Re: [R] combine two dataframe

2007-11-13 Thread Henrique Dallazuanna
Try this: merge(B, A) On 13/11/2007, sun <[EMAIL PROTECTED]> wrote: > I have two data frame A and B adn want to cross them. > A has format as: > > a1 a2 a3 > 1 23 > 2 31 > 1 32 > ... > > B: > > b1 b2 > 1 2 > 2 1 > ... > > the combine result shall be something like > > a1 a

[R] Discrimination of almost-random time series

2007-11-13 Thread Hans Werner Borchers
Dear time-series specialist: I've got some time series representing measurements from a physical process, like atomic decay data. These time series look almost random, but should hopefully be distinguishable as they were taken under different conditions. I am looking for statistical approaches th

[R] cbind function

2007-11-13 Thread livia
Hello everyone, I would like to use the "cbind" function to construct a dataset, combining some variable I defined before. The codes are something like var1 <- ... var2 <- ... var2 <- ... ... data <- cbind(var1,var2,var3...) The problem is I would like some flexibity in the data, i.e. the numbe

[R] combine two dataframe

2007-11-13 Thread sun
I have two data frame A and B adn want to cross them. A has format as: a1 a2 a3 1 23 2 31 1 32 ... B: b1 b2 1 2 2 1 ... the combine result shall be something like a1 a2 a3 b1 b2 1 2 3 1 2 1 2 3 2 1 2 3 1 1 2 2 3 1 2 1 1 3 2 1 2 1 3

Re: [R] Query an Access database based on a date attribute (Tudor Bodea)

2007-11-13 Thread Baize, Harold
Tudor Bodea asked: >In this context, I try to get all the records for which market is atl-bos, >competitor is delta and dd is 2007-11-20 (first record above). To do this I >used >># channel <- odbcConnectAccess("test.mdb") >>res <- sqlQuery(channel, "select * from test_table where market = 'atl-

Re: [R] group mean, minus each row's value

2007-11-13 Thread Dimitris Rizopoulos
do you mean something like this: tapply(x, g, function (y) { sapply(1:length(y), function (i) mean(y[-i])) }) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuv

[R] negative binomial lmer

2007-11-13 Thread Tonker
Hi I am running an lmer which works fine with family=poisson mixed.model<-lmer(nobees~spray+dist+flwabund+flwdiv+round+(1|field),family="poisson",method="ML",na.action=na.omit) But it is overdispersed. I tried using family=quasipoisson but get no P values. This didnt worry me too much as i thin

Re: [R] how to assign a group mean to individual cases?

2007-11-13 Thread Emmanuel Charpentier
Answering to myself... Emmanuel Charpentier a écrit : > Casey Klofstad a écrit : >> I need advice on how to create a variable that is the group mean of >> another variable. >> >> For example, I have a variable called x for which each row in the data >> set has a value. I also have a nominal variabl

[R] resampling

2007-11-13 Thread Itziar Frades Alzueta
Dear all, I sample without replacement elements of a vector and generate a new vector: kl<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,7,7,8,8, 8,8,8,8,8,8,8) the_index<-c(sample(40,35)) for(fs in 1:length(the_index)){if(fs==1){s<-c(kl[the_index[fs]])}else{s<- append

Re: [R] time plotting problem

2007-11-13 Thread John Kane
I clearly spoke too soon. With the actual data I am not getting sensible x-axis units. The program with the actual data below. Graph output is here: http://ca.geocities.com/jrkrideau/R/hd.png . I seem to be getting only a single entry for the x-axis of "2007". However dates range from Firs

[R] group mean, minus each row's value

2007-11-13 Thread Casey Klofstad
I used the following to assign each row the group average, where w is the new group average variable, x is the variabale to be averaged, and g is the nominal group indicator: w <- ave(x,g) Now I want to calculate the group average, but WITHOUT each row's value of x. Is there an easy way to do thi

Re: [R] script fails because of library loading

2007-11-13 Thread Prof Brian Ripley
On Tue, 13 Nov 2007, Muiser, EC wrote: > Thank you very much Alberto! Atleast I can see there is an error now. > The error however is strange. If I load the library in an R console it works > perfectly but the package seems not to exist if I run R from a script. The > library should be there. >

Re: [R] `eval' and environment question

2007-11-13 Thread Gabor Grothendieck
I think you are looking for eval(quote(x), ...) or evalq(x, ...) . Those do what you expect. The code you show evaluates x before eval even gets a chance to deal with it. On Nov 13, 2007 9:48 AM, Joerg van den Hoff <[EMAIL PROTECTED]> wrote: > > On Tue, Nov 13, 2007 at 09:04:25AM -0500, Duncan Mu

Re: [R] Using lme (nlme) to find the conditional variance of therandom effects

2007-11-13 Thread Douglas Bates
On Nov 13, 2007 1:02 AM, Rick Bilonick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-11-13 at 01:03 -0500, Rick Bilonick wrote: > > > > > Is there some way to get ranef with postVar=TRUE to show what the > > variances are, or what the lower and upper bounds are? qqmath makes nice > > plots but I need t

Re: [R] `eval' and environment question

2007-11-13 Thread Joerg van den Hoff
On Tue, Nov 13, 2007 at 09:04:25AM -0500, Duncan Murdoch wrote: > On 11/13/2007 8:39 AM, Joerg van den Hoff wrote: > >my understanding of `eval' behaviour is obviously > >incomplete. > > > >myquestion: usually `eval(expr)' and `eval(expr, > >envir=parent.frame())' should be i

Re: [R] R: Query an Access database based on a date attribute

2007-11-13 Thread Tudor Bodea
Stefano, It did work - for some reason, the date components to be used in the sqlQuery need to be placed in between hashes (i.e., #) for them to be interpreted correctly. Thank you so much. Tudor Quoting Guazzetti Stefano <[EMAIL PROTECTED]>: > It seems that Access needs that you surround the

[R] constraining the shape of a PDF

2007-11-13 Thread tibi . codilean
Dear all, This is probably off topic, but I did not know where to turn and since most of you have an excellent knowledge of statistics, I thought of sending my question to this list. I was wondering whether there is some literature on (or a way to calculate) how many data points one would need to

[R] map - mapproj : problem of states localisation

2007-11-13 Thread Amandine Chevalier
Hi R-user, I am new with R and I have a problem with the map and mapproj fonctions : with the following code : >test_proj=mapproject(LONG_d01_vec_t1, LAT_d01_vec_t1, projection="lambert", parameters=c(30,60)) >longitude_vec=test_proj$x >latitude_vec=test_proj$y >longitude_mat=matrix(longitude_

Re: [R] ESRI Shapefile for EU-25

2007-11-13 Thread hadley wickham
http://www.openstreetmap.org/ might be one place to start. Hadley On Nov 13, 2007 6:30 AM, Albrecht Kauffmann <[EMAIL PROTECTED]> wrote: > Hi all, > > who knows how to get an ESRI Shapefile for the NUTS-2 Regions of the > enlarged European Union? Particularly I want to draw maps of Germany, > Pol

Re: [R] how to assign a group mean to individual cases?

2007-11-13 Thread Emmanuel Charpentier
Casey Klofstad a écrit : > I need advice on how to create a variable that is the group mean of > another variable. > > For example, I have a variable called x for which each row in the data > set has a value. I also have a nominal variable called g that > indicates which of 100 different groups ea

Re: [R] Using lme (nlme) to find the conditional varianceof therandom effects

2007-11-13 Thread Doran, Harold
Yes. The variances are an attribute, and you can grab them like this: fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) attr(ranef(fm1, postVar = TRUE)[[1]], "postVar") > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Rick Bilonick > Sent:

Re: [R] `eval' and environment question

2007-11-13 Thread Duncan Murdoch
On 11/13/2007 8:39 AM, Joerg van den Hoff wrote: > my understanding of `eval' behaviour is obviously > incomplete. > > myquestion: usually `eval(expr)' and `eval(expr, > envir=parent.frame())' should be identical. why does the > last `eval' (yielding `r3') in this code

Re: [R] script fails because of library loading

2007-11-13 Thread Muiser, EC
Thank you very much Alberto! Atleast I can see there is an error now. The error however is strange. If I load the library in an R console it works perfectly but the package seems not to exist if I run R from a script. The library should be there. Errorlog: Error in library(tgp) : there is no

Re: [R] factors levels ?

2007-11-13 Thread W Eryk Wolski
Thanks... Thats exactly what I was looking for.. Eryk On Nov 13, 2007 2:38 PM, Eik Vettorazzi <[EMAIL PROTECTED]> wrote: > cut(X,Y,right=F) > > W Eryk Wolski schrieb: > > > Hi, > > > > It's just some example code.. The application is uninteresting. I am > > searching for some functionality. > >

Re: [R] factors levels ?

2007-11-13 Thread jombart
Hi, see ?cut ?pretty can also help to define "boundaries". Regards, Thibaut. > Hi, > > It's just some example code.. The application is uninteresting. I am > searching for some functionality. > > X <- rnorm(100) //my data > > Y <- seq(-3,3,by=0.1) // bin boundaries. > > Now I would like to gene

Re: [R] help on drawing a tree with "ape"?

2007-11-13 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hua Li wrote: > Thank you very much for the help, Ben! > > As a follow up, is there a way to specify the labels, > through the way the text is written, rather than > reading the edge positions from the graph? For > example, > > mytree = > "((A:51.78

[R] `eval' and environment question

2007-11-13 Thread Joerg van den Hoff
my understanding of `eval' behaviour is obviously incomplete. myquestion: usually `eval(expr)' and `eval(expr, envir=parent.frame())' should be identical. why does the last `eval' (yielding `r3') in this code _not_ evaluate in the local environment of function `f' b

Re: [R] factors levels ?

2007-11-13 Thread Chuck Cleland
W Eryk Wolski wrote: > Hi, > > It's just some example code.. The application is uninteresting. I am > searching for some functionality. > > X <- rnorm(100) //my data > > Y <- seq(-3,3,by=0.1) // bin boundaries. > > Now I would like to generate a - list of factors, length as X... > i.e.: all va

Re: [R] factors levels ?

2007-11-13 Thread Eik Vettorazzi
cut(X,Y,right=F) W Eryk Wolski schrieb: > Hi, > > It's just some example code.. The application is uninteresting. I am > searching for some functionality. > > X <- rnorm(100) //my data > > Y <- seq(-3,3,by=0.1) // bin boundaries. > > Now I would like to generate a - list of factors, length as X..

Re: [R] How to count the number of sequences in matrix?

2007-11-13 Thread Dimitris Rizopoulos
one approach is the following: res <- apply(g, 1, function (x) { out <- rle(as.logical(x)) out <- out$lengths[out$values] ln <- length(out) c(rep(ln, ln), out) }) cbind(rep(1:nrow(g), sapply(res, length) / 2), do.call("rbind", sapply(res, matrix, ncol = 2))) I hope it helps.

[R] factors levels ?

2007-11-13 Thread W Eryk Wolski
Hi, It's just some example code.. The application is uninteresting. I am searching for some functionality. X <- rnorm(100) //my data Y <- seq(-3,3,by=0.1) // bin boundaries. Now I would like to generate a - list of factors, length as X... i.e.: all values in the range [-3,-2.9) have the same f

Re: [R] script fails because of library loading

2007-11-13 Thread Alberto Monteiro
Muiser, EC wrote: > > The php script executes the following command: "/usr/bin/R --quiet -- > slave < /perl/outfiles/Rscript19785065.R > /perl/outfiles/error19785065.txt" > Also there is no errorlog (in > "/perl/outfiles/error19785065.txt") This part is easy: the error output should go to 2>

[R] How to count the number of sequences in matrix?

2007-11-13 Thread Lauri Nikkinen
Hi R-users, I have a matrix similar to this. I would like to calculate the number of 1 sequences in a row and also the length of the 1 sequence. For instance, in the example below, row number one has four sequences of number 1 (from left to right: 1; 1; 1,1; 1) and the corresponding SeqCount is 4

Re: [R] percent inclusion in cph

2007-11-13 Thread Frank E Harrell Jr
sushi4u wrote: > Dear R-help, > > I have to calculate the percent inclusion of each variable in a bootstrap > validation of a cox proportional hazards model(described in Sauerbrei and > Schumacher, Stat Med 11:1093, 1992). > This approach is not recommended. Collinearities can ruin the resul

[R] script fails because of library loading

2007-11-13 Thread Muiser, EC
Hello everyone, I am busy making a website that uses R to plot certain biological data, but there is a problem when I try load packages. The php script executes the following command: "/usr/bin/R --quiet --slave < /perl/outfiles/Rscript19785065.R > /perl/outfiles/error19785065.txt" The R scri

[R] ESRI Shapefile for EU-25

2007-11-13 Thread Albrecht Kauffmann
Hi all, who knows how to get an ESRI Shapefile for the NUTS-2 Regions of the enlarged European Union? Particularly I want to draw maps of Germany, Poland, Czech Republik, Hungary and Austria. I've found Shapefiles for the US, Russia and other countries elsewhere in the web, but for Europe it seems

Re: [R] finding the annual maximun within several years

2007-11-13 Thread Gabor Grothendieck
We can do this using chron and zoo. First turn it into a zoo series, z, using chron times, tt, which may not only be useful for this but also for other purposes. The ave(...) command gets a vector as long as the series with the minimum dates in year each and then we aggregate z by that using max.

[R] plotting coxph results using survfit() function

2007-11-13 Thread Shoaaib Mehmood
i want to make survival plots for a coxph object using survfit function. mod.phm is an object of coxph class which calculated results using columns X and Y from the DataFrame. Both X and Y are categorical. I want survival plots which shows a single line for each of the categories of X i.e. '4' and

[R] R: Query an Access database based on a date attribute

2007-11-13 Thread Guazzetti Stefano
It seems that Access needs that you surround the dates with a # symbol. You probably need something like. res <- sqlQuery(channel, "select * from test_table where market = 'atl-bos' and competitor = 'delta' and dd = #2007-11-20#") Hope this helps, Stefano -Messaggio o

Re: [R] Multivariate time series

2007-11-13 Thread Giusy
Thank you very much for your answers,you are all very kind!Excuse me, can I make another question about time series? When I use arimaId or best.arima function in package forecast, I can't insert regressors, I can insert them only when I make predictions.. But isn't the model influenced by regresso

Re: [R] How can I fitting this function from values.

2007-11-13 Thread Horacio Castellini
Thanks for the help received, I will test the proposal. > R is case sensitive ;-) so in your list of start values you must have B=3 and > not b=3. Perhaps you have an object named b of a different length than your > data somewhere giving rise to your error message. > > Also brute force wont work

Re: [R] a very easy question, how to extract the name of the response variable

2007-11-13 Thread Prof Brian Ripley
On Tue, 13 Nov 2007, Eric R. wrote: > > This may not be the smoothest way to produce the result, but here is a > two-step solution: > > first find the formula within the object created by the call to glm(): > > form <- qq["formula"] or equivalently form <- qq$formula Oh, please , do use extractor

Re: [R] Multivariate time series

2007-11-13 Thread Giusy
Hello to everyone, thank you for your answers, you are all very kind! I'll have a look to the package you advised me. Paul, I saw dse package, but I didn't understand how to use it.. For example, I have 2 sales series: item_1 item_2 price_item1 price_item2 0 0 26

  1   2   >