[R] write.table

2009-02-19 Thread lauramorg...@bluewin.ch
Hello, I tried to turn lists into vectors and then bind them together in order to create a dataframe but if, after this, I try to use the function write.table I get the following error message: Error in write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec, as.integer(quote), : 'list'

Re: [R] modifying legend in scatterplot matrix R

2009-02-19 Thread Dieter Menne
Julien Beguin ulaval.ca> writes: > scatterplot.matrix(~ a + b + c, >groups=treatment, ... >legend.plot=T, >) > legend("topright",c("fenced","unefenced"), fill=NULL,bty="o",cex=3) > > > In my

[R] smoothing 2D vector field

2009-02-19 Thread _
Hi all, is there a function / package in R that provides a function like Matlab's conv2 or filter2 for smoothing a vector- / velocity- field. I unfortunately could not find anything. Thanks a lot. __ R-help@r-project.org mailing list https://stat.eth

[R] log-minus-log plot

2009-02-19 Thread C.H.
Dear experts, I would like to know how to plot the log-minus-log plot for survival analysis (to check the proportional assumption) in R. Using the AML example. fit <- survfit(Surv(time, status) ~ x, data=aml) length(fit$surv) #20 as the length of fit$surv is shorter than aml$x and aml$time. I d

Re: [R] problem with comparing a part of string with whole string

2009-02-19 Thread venkata kirankumar
Hi , i just attached one file to this mail which contains one modal of my data and there i have to search for the rows which contains "SPECIMENTYP %in% "ADIPOSE TISSUE"" and the rows which contains " "PRESERVED"in ORGCHARRES for that i tried with " r<-subset(rr,SPECIMENTYP %in% "ADIPOSE

[R] importing data to SQLite database with sqldf

2009-02-19 Thread Stephen Tucker
Hi all, I am attempting to learn SQL through sqldf... One task I am particularly interested in is merging separate (presumably large) files into a single table without loading these files into R as an intermediate step (by loading them into SQLite and merging them there). Taking a step back, I'v

Re: [R] Build R-2.8.1 on AIX5.3

2009-02-19 Thread Ei-ji Nakama
> I have succesfully built R-2.8.1 on AIX,but I also found a problem in my > build process-- the 783 line on patch file should be combined with 782 > line. Oops, mended. http://prs.ism.ac.jp/~nakama/AIX/AIX_R-2.8.1_fix.patch Now, I do not have AIX that can be tested.:( Thank you Jin. -- EI-JI

Re: [R] Build R-2.8.1 on AIX5.3

2009-02-19 Thread 亿元五角
Thanks for Ej-ji's help. I have succesfully built R-2.8.1 on AIX,but I also found a problem in my build process-- the 783 line on patch file should be combined with 782 line. Thanks for Ei-ji again. Jin > Date: Thu, 19 Feb 2009 09:39:26 + > From: rip...@stats.ox.ac.uk > To: nak...@

Re: [R] RODBC crashes connecting to Teradata

2009-02-19 Thread Graham Williams
Received Fri 19 Dec 2008 7:38am +1100 from Prof Brian Ripley: > On Thu, 18 Dec 2008, Francisco Javier Perez Caballero wrote: > >> Hi, I'm trying to connect to a Teradata database via RODBC on a Linux 64 >> machine (Red Hat Enterprise Linux 5). [...] >>> library(RODBC) >>> conn = odbcConnect("th

[R] equivalent function to MatLab 'step' ?

2009-02-19 Thread Carl Witthoft
I have to admit I don't fully understand how MatLab's step() function works, but I'm learning that part. Can someone point me to equivalent&related functions in R? thanks Carl __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listin

[R] residuals from a fractional arima model and other questions

2009-02-19 Thread Horace Tso
Dear list and Martin, I'm testing different approaches to fit an electricity demand time series and come upon the fracdiff package (v 1.3-1) for fitting fractional ARIMA models. The following questions are motivated by this package. 1. Despite having a help page, the residuals and fitted functi

Re: [R] How to unload a dll loaded via library.dynam()?

2009-02-19 Thread Gábor Csárdi
Hmmm, I think restarting R is not a very good solution. It is rather ugly in the first place. But perhaps even more importantly, it can be rather inconvenient if one has a large data set in the memory and needs to save/load it just to reload a package that was updated in the meanwhile. This happen

Re: [R] How to unload a dll loaded via library.dynam()?

2009-02-19 Thread Duncan Murdoch
On 19/02/2009 6:19 PM, Alex F. Bokov wrote: Hello. To save the hassle of quitting and restarting R every time I rebuild the package I'm working on (for the purposes of this question called "roots") I would like to write a script cleanly remove the package from my R session and then load it agai

Re: [R] Arima bug?

2009-02-19 Thread Peter Dalgaard
rkevinbur...@charter.net wrote: I was looking at the 'R' code associated with arima. I see the following: upARIMA <- function(mod, phi, theta) { p <- length(phi) q <- length(theta) mod$phi <- phi mod$theta <- theta r <- max(p, q + 1) if (p > 0)

[R] How to unload a dll loaded via library.dynam()?

2009-02-19 Thread Alex F. Bokov
Hello. To save the hassle of quitting and restarting R every time I rebuild the package I'm working on (for the purposes of this question called "roots") I would like to write a script cleanly remove the package from my R session and then load it again. Of course detach("package:roots") works fo

Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009

2009-02-19 Thread Paul Heinrich Dietrich
Hi Kees, No harm no foul. I'm glad you posted that anyway, because now anyone who's trying to do the same thing and read this will know to seek your 1.1.9 version and stay away from 1.1.15. Paul chaogai-2 wrote: > > I do not know about the ubuntu instructions, they would not help me on > Sus

[R] Arima bug?

2009-02-19 Thread rkevinburton
I was looking at the 'R' code associated with arima. I see the following: upARIMA <- function(mod, phi, theta) { p <- length(phi) q <- length(theta) mod$phi <- phi mod$theta <- theta r <- max(p, q + 1) if (p > 0) mod$T[1:p, 1] <- phi

[R] change the label size when drawing trees with ape

2009-02-19 Thread Hua Li
Hi All, I want to be able to change the labe size on a tree when using ape package so that the graph can look nicer, but don't know how. Playing with the "font" doesn't seem to help. (Right now the labels barely show.) Thanks for your help! Code I'm using now #- t1 = "

Re: [R] Detecting startup flags from within R.

2009-02-19 Thread Barry Rowlingson
2009/2/19 Rolf Turner : > > > Is there a way to detect from within R whether, e.g., R has been > started with the --no-restore-data flag set? So as to be able > to invoke code along the following lines: > >if( --no-restore-data flag set) { >do something >} else { >

[R] Detecting startup flags from within R (never mind, I figured it out).

2009-02-19 Thread Rolf Turner
Just after sending my inquiry I found the answer myself: Use commandArgs(). Duh! Sorry for wasting bandwidth. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{d

[R] Detecting startup flags from within R.

2009-02-19 Thread Rolf Turner
Is there a way to detect from within R whether, e.g., R has been started with the --no-restore-data flag set? So as to be able to invoke code along the following lines: if( --no-restore-data flag set) { do something } else { do something else

Re: [R] Getting the difference between two data frames

2009-02-19 Thread Rolf Turner
On 20/02/2009, at 11:23 AM, Ferry wrote: Dear R users, I have the following data: x <- data.frame( myX = c(1,2,3,4,5,6,7,8,9) ) y <- data.frame( myX = c(1,2,3,4,5,6,7) ) How can I get the difference between data frame x and y? In this case, I want to get values 8 and 9 I know in SQL we can u

Re: [R] transform key value pair to column

2009-02-19 Thread Tan, Richard
Thank you, works! -Original Message- From: Rowe, Brian Lee Yung (Portfolio Analytics) [mailto:b_r...@ml.com] Sent: Thursday, February 19, 2009 5:52 PM To: Wacek Kusnierczyk; Tan, Richard Cc: r-help@r-project.org Subject: RE: [R] transform key value pair to column Try this: > dummy id

Re: [R] transform key value pair to column

2009-02-19 Thread Rowe, Brian Lee Yung (Portfolio Analytics)
Try this: > dummy id code value 1 1 hi 10.3 2 1 lo 5.2 3 2 hi 19.4 4 3 hi 20.0 5 3 lo 12.0 6 4 lo 5.8 > reshape(dummy, idvar='id', timevar='code', direction='wide') id value.hi value.lo 1 1 10.3 5.2 3 2 19.4 NA 4 3 20.0 12.0 6 4 N

Re: [R] everybody loves R...

2009-02-19 Thread Wacek Kusnierczyk
Liviu Andronic wrote: > On Thu, Feb 19, 2009 at 5:29 PM, Gábor Csárdi wrote: > >> I don't want to be mean, I really like wikidot, but isn't it a better >> solution to use the R wiki instead? >> >> http://wiki.r-project.org/rwiki/doku.php >> >> > Or even to contribute to existing well-str

Re: [R] transform key value pair to column

2009-02-19 Thread Wacek Kusnierczyk
see ?stack, for example. vQ Tan, Richard wrote: > Hi, is there a good way (instead of a time-consuming for loop) to > transfer a key/value pair dataframe to a dataframe with key as column > and value as row? For example, I have a dataframe with three columns: > id, code, value: > > id,code,val

Re: [R] everybody loves R...

2009-02-19 Thread Liviu Andronic
On Thu, Feb 19, 2009 at 5:29 PM, Gábor Csárdi wrote: > I don't want to be mean, I really like wikidot, but isn't it a better > solution to use the R wiki instead? > > http://wiki.r-project.org/rwiki/doku.php > Or even to contribute to existing well-structured sites such as Quick-R [1]? It would av

[R] transform key value pair to column

2009-02-19 Thread Tan, Richard
Hi, is there a good way (instead of a time-consuming for loop) to transfer a key/value pair dataframe to a dataframe with key as column and value as row? For example, I have a dataframe with three columns: id, code, value: id,code,value 1,hi,10.3 1,lo,5.2 2,hi,19.4 3,hi,20 3,lo,12 4,lo,5.8 I w

[R] Getting the difference between two data frames

2009-02-19 Thread Ferry
Dear R users, I have the following data: x <- data.frame( myX = c(1,2,3,4,5,6,7,8,9) ) y <- data.frame( myX = c(1,2,3,4,5,6,7) ) How can I get the difference between data frame x and y? In this case, I want to get values 8 and 9 I know in SQL we can use minus operator, but I have no idea how to

[R] Roadmap for selecting an approach to analyzing repeated measures data

2009-02-19 Thread Frank E Harrell Jr
Dear Group, At http://biostat.mc.vanderbilt.edu/tmp/summary.pdf I have put a draft of a roadmap for choosing a method for analyzing serial (longitudinal) data. If anyone has feedback about this, including adding criteria for judging methods that I may have missed, I would appreciate hearing f

Re: [R] colored maps again

2009-02-19 Thread Greg Snow
The problem is that the order and number of polygons in map does not match your data (most likely). Try: library(maps) library(plotrix) state.col<-color.scale(state.x77[,'HS Grad'],0,0,c(0,1)) map("state",fill=TRUE,col=state.col) nms <- map('state', plot=FALSE)$names nms <- sub(':.*$','',nms)

[R] using stepAIC with negative binomial regression - error message

2009-02-19 Thread t c
Ben, I tried playing with the "na.action" but that didn't seem to help.  I didn't know of the na.omit function.  It made it much easier to get rid of all the missing values in the file, and now the regression model is running. I hadn't put interactions in the model yet since it wasn't even runn

[R] modifying legend in scatterplot matrix R

2009-02-19 Thread Julien Beguin
Hello R users, I have some troubles to modify the "per default" legend in the scatterplot.matrix using the car package. Here is my code: scatterplot.matrix(~ a + b + c, groups=treatment, by.groups=F,

Re: [R] Using R in Java?

2009-02-19 Thread Bryan Coon
Wow, very interesting! The netbeans example looks similar to what I want, which is based on Eclipse RCP. I will explore this more, as well as the JRI indirect method suggested by Christian. Thanks! -Original Message- From: Roy Mendelssohn [mailto:roy.mendelss...@noaa.gov] Sent: Thursda

Re: [R] Source code for nlm()

2009-02-19 Thread Ravi Varadhan
Thank you, Chris and Duncan. It never occurred to me to look in optimize.c since optimize() does univariate minimization. Furthermore, now I know that the underlying Fortran code (OPTIF9) is from the UNCMIN library (may be this should be mentioned in the help page, although once can get to this i

Re: [R] Using R in Java?

2009-02-19 Thread Roy Mendelssohn
See also Biocep: http://biocep-distrib.r-forge.r-project.org/ -Roy M. On Feb 19, 2009, at 10:42 AM, Christian Ruckert wrote: nicro schrieb: Hi 2 questions- 1. Is there a package that will allow me to run R scripts (entirely) from Java? 2. If so, is there a way to capture the output of tho

Re: [R] Doing pairwise comparisons using either Duncan, Tukey or LSD

2009-02-19 Thread Kingsford Jones
try: example(TukeyHSD) hth, Kingsford Jones On Thu, Feb 19, 2009 at 9:51 AM, Saeed Ahmadi wrote: > > Hi, > > I have a basic and simple question on how to code pairwise (multiple) mean > compariosn between levels of a factor using one of the Duncan, Tukey or LSD. > > Thanks in advance, > Saeed

Re: [R] Using R in Java?

2009-02-19 Thread Christian Ruckert
nicro schrieb: Hi 2 questions- 1. Is there a package that will allow me to run R scripts (entirely) from Java? 2. If so, is there a way to capture the output of those scripts, (including images) and embed them in my SWT java app? My challenge is I have a java app that does some statistical chore

Re: [R] Source code for nlm()

2009-02-19 Thread Duncan Murdoch
On 19/02/2009 1:00 PM, Ravi Varadhan wrote: Hi, Where can I find the source code for nlm()? I dowloaded the R2.8.1.tar.gz file and looked at all the .c and .f files, but couldn't find either nlm.c or nlm.f There is an nlm.r file, but that is not useful. I don't see why you say it's not us

Re: [R] Source code for nlm()

2009-02-19 Thread Christos Hatzis
It seems to be in optimize.c Rgonzui has a very nice search facility for source of R or CRAN packages (however it is against R 2.8.0 source): http://rgonzui.nakama.ne.jp/R/markup/R-2.8.0/src/main/optimize.c?fm=c&q=nlm# l378 -Christos > -Original Message- > From: r-help-boun...@r-project.

Re: [R] Doing pairwise comparisons using either Duncan, Tukey or LSD

2009-02-19 Thread Chuck Cleland
On 2/19/2009 11:51 AM, Saeed Ahmadi wrote: > Hi, > > I have a basic and simple question on how to code pairwise (multiple) mean > compariosn between levels of a factor using one of the Duncan, Tukey or LSD. Here is one approach: library(multcomp) summary(glht(lm(Petal.Width ~ Species, data =

[R] Using R in Java?

2009-02-19 Thread nicro
Hi 2 questions- 1. Is there a package that will allow me to run R scripts (entirely) from Java? 2. If so, is there a way to capture the output of those scripts, (including images) and embed them in my SWT java app? My challenge is I have a java app that does some statistical chores- it would be f

[R] Doing pairwise comparisons using either Duncan, Tukey or LSD

2009-02-19 Thread Saeed Ahmadi
Hi, I have a basic and simple question on how to code pairwise (multiple) mean compariosn between levels of a factor using one of the Duncan, Tukey or LSD. Thanks in advance, Saeed -- View this message in context: http://www.nabble.com/Doing-pairwise-comparisons-using-either-Duncan%2C-Tukey-

[R] TAR Models and predictive residuals

2009-02-19 Thread Andreas Klein
Hello R users. There is a paper from Ruey Tsay with the title: "Testing and Modelling Threshold Autoregressive Processes", published in 1989 in the Journal of the American Statistical Association (March, Vol. 84, No. 405). Mr. Tsay describes a very interesting way of identifying and modelling

Re: [R] read.table : how to condition on error while opening file?

2009-02-19 Thread lauramorg...@bluewin.ch
Hello Stephane, here is something you could try, filelist <- c("file1.txt", "file2.txt", "file3.txt") for (i in 1:3) { tmpList<-try(read.table(filelist[[i]]), silent=TRUE) if(inherits(tmpList, "try-error")) {print(paste("error opening file ", filelist[[i]])) } else { tmp<-read.table(filelist[[i]]

Re: [R] Python and R

2009-02-19 Thread Gabor Grothendieck
On Thu, Feb 19, 2009 at 8:30 AM, Esmail Bonakdarian wrote: > Hi Kenn, > > Thanks for the suggestions, I'll have to see if I can figure out how to > convert the relatively simple call to lm with an equation and the data file > to the functions you mention (or if that's even feasible). X <- model.m

[R] Source code for nlm()

2009-02-19 Thread Ravi Varadhan
Hi, Where can I find the source code for nlm()? I dowloaded the R2.8.1.tar.gz file and looked at all the .c and .f files, but couldn't find either nlm.c or nlm.f There is an nlm.r file, but that is not useful. Thanks for any help, Ravi. -

Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009

2009-02-19 Thread chaogai
I do not know about the ubuntu instructions, they would not help me on Suse. The wine version is 1.1.9. I thought that was the latest,but when I checked latest is 1.1.15, which does indeed throw the blackbox error. So, now it does not work for me either Sorry I gave bad advise kees On Thu, 19 Fe

Re: [R] problem with using %in% condition while using in if() condition

2009-02-19 Thread Greg Snow
The %in% operator returns a vector of logicals the same length as the vector to the left. The if program flow operator expects a single logical value, not a vector, since you are giving it a vector it looks at just the 1st element, ignores the rest and gives the warning. This warning should be

Re: [R] colored maps again

2009-02-19 Thread Mike Lawrence
Here's a bit of a hacky way to do it: #get the names of each state state=map('state',plot=F)$names #set up some random state-color data cols = as.data.frame(cbind(state=states,x=sample(1:10,length(states),replace=T))) #do the plot map('usa') for(this_state in state){ map('state',regio

Re: [R] matrix computation???

2009-02-19 Thread Greg Snow
You are computing the hat matrix to predict stack.loss, but stack.loss is a column in the A matrix, so you predictions are all perfect (given stack.loss, what is stack.loss, fairly simple answer, all errors are 0). I think you want to redo this using only the 3 columns other than stack.loss in

Re: [R] Unadulterated plot

2009-02-19 Thread Duncan Murdoch
James Nicolson wrote: To All, I'm using R 2.8.1. I have attached two images, one shows what I get and the other shows what I want. All I want is the plotting region. Surely there must be a way of plotting individual regions/components in R? Patrizio, I prefer filled.contour() for my data. I sti

Re: [R] an S idiom for ordering matrix by columns?

2009-02-19 Thread Aaron Mackey
Thanks to all, "do.call(order, as.data.frame(y))" was the idiom I was missing! -Aaron On Thu, Feb 19, 2009 at 11:52 AM, Gustaf Rydevik wrote: > On Thu, Feb 19, 2009 at 5:40 PM, Aaron Mackey wrote: > > There's got to be a better way to use order() on a matrix than this: > > > >> y > >2L-035-

Re: [R] indicator or deviation contrasts in log-linear modelling

2009-02-19 Thread Charles C. Berry
On Wed, 18 Feb 2009, maiya wrote: I realise that in the case of loglin the parameters are clacluated post festum from the cell frequencies, however other programmes that use Newton-Raphson as opposed to IPF work the other way round, right? In which case one would expect the output of parameters

Re: [R] Questions about biglm

2009-02-19 Thread John Fox
Dear Greg and Dobo, The vif() in the car package computes VIFs (and generalized VIFs) from the covariance matrix of the coefficients; I'm not sure whether it will work directly on objects produced by biglm() but if not it should be easily adapted to do so. I hope this helps, John --

Re: [R] counting strings in a column

2009-02-19 Thread Clint Bowman
Try: a<-c("o","o","a","a","g","o","a","p") table(a) a a g o p 3 1 3 1 Clint BowmanINTERNET: cl...@ecy.wa.gov Air Dispersion Modeler INTERNET: cl...@math.utah.edu Air Quality Program VOICE: (360) 407-6815 Department of Ecology

Re: [R] counting strings in a column

2009-02-19 Thread jim holtman
?table On Thu, Feb 19, 2009 at 11:48 AM, Nattu wrote: > Dear All, > > I have a query : what is the command to count number of repeated words in a > column. > > for ex: > > a = > > oranges > oranges > apples > apples > grape > oranges > apple > pine > > > the result should be > oranges 3 > apples

Re: [R] an S idiom for ordering matrix by columns?

2009-02-19 Thread Gustaf Rydevik
On Thu, Feb 19, 2009 at 5:40 PM, Aaron Mackey wrote: > There's got to be a better way to use order() on a matrix than this: > >> y >2L-035-3 2L-081-23 2L-143-18 2L-189-1 2R-008-5 2R-068-15 3L-113-4 > 3L-173-2 > 3981 1 221 12 > 2 > 857

Re: [R] an S idiom for ordering matrix by columns?

2009-02-19 Thread jim holtman
How about this: > x <- matrix(sample(0:1,100,TRUE),10) > # create a list of all the columns to sort > col.list <- lapply(seq(ncol(x)), function(a) x[,a]) > # now sort the matrix > x[do.call(order, col.list),] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]00100

[R] counting strings in a column

2009-02-19 Thread Nattu
Dear All, I have a query : what is the command to count number of repeated words in a column. for ex: a = oranges oranges apples apples grape oranges apple pine the result should be oranges 3 apples 3 grape 1 pine 1 is there an easy way for this. Thanks, Nataraju GM R & D Bangalore -- "

[R] colored maps again

2009-02-19 Thread Alina Sheyman
I'm trying to create a colored map that would show the number of students per state. My data frame consists of two columns - state and count. I'm using the following code library(maps) map("usa") library(plotrix) state.col<-color.scale(gre$count,0,0,c(0,1)) map("state",fill=TRUE,col=state.col) I

[R] an S idiom for ordering matrix by columns?

2009-02-19 Thread Aaron Mackey
There's got to be a better way to use order() on a matrix than this: > y 2L-035-3 2L-081-23 2L-143-18 2L-189-1 2R-008-5 2R-068-15 3L-113-4 3L-173-2 3981 1 221 12 2 8571 1 221 22 2 91

Re: [R] Questions about biglm

2009-02-19 Thread Greg Snow
The idea of the biglm function is to only have part of the data in memory at a time. You read in part of the data and run biglm on that section of the data, then delete it from memory, load in the next part of the data and use update to include the new data in the analysis, delete that, read in

Re: [R] read.table : how to condition on error while opening file?

2009-02-19 Thread Eik Vettorazzi
Hi Stephane, see ?try hth. Stephane Bourgeois schrieb: Hi, I'm using read.table in a loop, to read in multiple files. The problem is that when a file is missing there is an error message and the loop is broken; what I'd like to do is to test for the error and simply do "next" instead of br

Re: [R] everybody loves R...

2009-02-19 Thread Gábor Csárdi
I don't want to be mean, I really like wikidot, but isn't it a better solution to use the R wiki instead? http://wiki.r-project.org/rwiki/doku.php G. On Thu, Feb 19, 2009 at 4:44 PM, thefurryblur wrote: > > Just thought I'd let you guys know about this site I stumbled across: > http://riki.wiki

[R] everybody loves R...

2009-02-19 Thread thefurryblur
Just thought I'd let you guys know about this site I stumbled across: http://riki.wikidot.com/ http://riki.wikidot.com/ It is obviously in its early stages (as it does not have any content yet) but is looking like a good place to build a simple knowledge base for the R software. Anyway, if any o

Re: [R] Unadulterated plot

2009-02-19 Thread James Nicolson
To All, I'm using R 2.8.1. I have attached two images, one shows what I get and the other shows what I want. All I want is the plotting region. Surely there must be a way of plotting individual regions/components in R? Patrizio, I prefer filled.contour() for my data. I still have the same problem

[R] read.table : how to condition on error while opening file?

2009-02-19 Thread Stephane Bourgeois
Hi, I'm using read.table in a loop, to read in multiple files. The problem is that when a file is missing there is an error message and the loop is broken; what I'd like to do is to test for the error and simply do "next" instead of breaking the loop. Anybody knows how to do that? Example:

Re: [R] type III effect from glm()

2009-02-19 Thread John Fox
Dear Mark and Simon, I assume from the variable names that siteall and district are factors and that yrs is numeric. If that's the case, then the second model formula, ~ siteall + district + yrs:district, nests yrs within district, that is, will fit a separate slope for years within each level of

Re: [R] Need Help for creating a new variable

2009-02-19 Thread Stavros Macrakis
On Thu, Feb 19, 2009 at 9:50 AM, Jorge Ivan Velez wrote: > mydata$trt<-with(mydata,paste(diet,vesl,sep="")) Besides the above (good!) solution, you might want to understand why your original solution didn't work: >> > mydata$trt<-ifelse(mydata$diet=="C" && mydata$vesl=="A", "CA", >> +

[R] Help on warning message from Neg. Binomial error during glm

2009-02-19 Thread Mahua Ghara
I am using glm.nb, a ~b*c ( b is categorical and c is continuous). when I run this model I get the warning message: Warning messages: 1: In theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace = control$trace > : iteration limit reached 2: In theta.ml(Y, mu, sum(w), w, limit = control$maxit,

Re: [R] Need Help for creating a new variable

2009-02-19 Thread Jorge Ivan Velez
Dear Chun-Hao, How about this? diet<-sort(rep(x=c("C","T"),4)) vesl<-rep(x=c("A","P"),4) mydata<-data.frame(diet,vesl) mydata$trt<-with(mydata,paste(diet,vesl,sep="")) mydata HTH, Jorge On Thu, Feb 19, 2009 at 2:53 AM, Chun-Hao Tu wrote: > > > Hi R users, > > I did do the research and work o

Re: [R] Age as time-scale in a cox model

2009-02-19 Thread Terry Therneau
You asked about survival curves with age scale versus follow-up scale. > fit1 <- coxph(Surv(time/365.25, status) ~ t5 + id + age, data=stanford2) > surv1<- survfit(fit1) > surv1 n events median 0.95LCL 0.95UCL 157.000 102.000 1.999 0.898 3.608 > summary(surv1, times=3) time n.ri

[R] Curso: Introduccion al idioma R

2009-02-19 Thread Sharon Lazenby
A Todos Todavía hay sitios para los próximos cursos. Para mas información y el formulario de inscripción pónganse en contacto con train...@mango-solutions.com, o visiten nuestro sitio Web www.mango-solutions.com . The R Language Introducción al idioma R

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread dwinsemius
- Original Message - From: "baptiste auguie" To: "Gundala Viswanath" Cc: "r-h...@stat.math.ethz.ch R-help" Sent: Thursday, February 19, 2009 7:12:23 AM GMT -06:00 US/Canada Central Subject: Re: [R] Insert value in a Vector Alternately Perhaps you can try this, > d <- c(0.003774

Re: [R] code patterns in vector

2009-02-19 Thread Duncan Murdoch
On 19/02/2009 9:26 AM, Stefan Uhmann wrote: Dear List, I have this column/vector: vec <- c("function", "missing", "string") and want to compute a second column/vector: - value if the pattern "unc" is found: 1 - value if the pattern "iss" is found: 2 - value if none of the patterns is found: 0

[R] code patterns in vector

2009-02-19 Thread Stefan Uhmann
Dear List, I have this column/vector: vec <- c("function", "missing", "string") and want to compute a second column/vector: - value if the pattern "unc" is found: 1 - value if the pattern "iss" is found: 2 - value if none of the patterns is found: 0 This should be the result: > vec2 [1] 1 2 0

Re: [R] Multiple merge, better solution?

2009-02-19 Thread Gabor Grothendieck
The zoo package has a multi-way merge for zoo objects. Its just do.call(merge, z) where z is a list of zoo objects. In detail: set.seed(1) DF1 <- data.frame(var1 = letters[1:5], a = rnorm(5), b = rnorm(5), c = rnorm(5)) DF2 <- data.frame(var1 = letters[3:7], a = rnorm(5), b = rnorm(5), c = r

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread baptiste auguie
thanks all for the correction, funny how it's often the complicated solution that comes to mind first. baptiste On 19 Feb 2009, at 13:41, Eik Vettorazzi wrote: actually c(rbind(0,matrix(d, nrow=3))) which has the bonus of giving the desired result ;) baptiste auguie schrieb: Perhaps y

[R] DLM and matrices with 0 eigenvalues

2009-02-19 Thread Rebecca Sela
I am using DLM to fit a state space model. The covariance matrix of states (W) is given by: a 0 a 0 0 0 0 0 a 0 a 0 0 0 0 0 where a is a parameter to be estimated. Even though the matrix is positive semidefinite, sometimes DLM gives me an error that W is not a valid variance matrix. As far as

Re: [R] Re : SVM regression code

2009-02-19 Thread Max Kuhn
You can find the complete list at: http://cran.r-project.org/web/views/MachineLearning.html Max __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.

Re: [R] Running out of memory when importing SPSS files

2009-02-19 Thread Paul Bivand
2009/2/19 Thomas Lumley : > On Wed, 18 Feb 2009, Uwe Ligges wrote: > >> dobomode wrote: >>> >>> Hello R-help, >>> >>> I am trying to import a large dataset from SPSS into R. The SPSS file >>> is in .SAV format and is about 1GB in size. I use read.spss to import >>> the file and get an error saying

[R] Problem in converting a string in binary formate

2009-02-19 Thread venkata kirankumar
Hi all, can any one suggest how to convert one string into binary formate to store in another file and to use for farther searching with using of binary files only that search can process for that i need to convert string into binary files thanks in advance [[alternative HTML version del

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread Eik Vettorazzi
actually c(rbind(0,matrix(d, nrow=3))) which has the bonus of giving the desired result ;) baptiste auguie schrieb: Perhaps you can try this, d <- c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, 0.00380083, 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083,

Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
Sorry, you don't need 'melt' : cast(truc, Subject ~ Quarter) 2009/2/19 David Hajage > "And I would like to group the Subject by Quarter using as a result in the > table the value of the third variable (Boolean). The final result would > give: > > Subjet Q1 Q2 Q3 Q4 > 1100 Y Y Y Y > 2

Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
"And I would like to group the Subject by Quarter using as a result in the table the value of the third variable (Boolean). The final result would give: Subjet Q1 Q2 Q3 Q4 1100 Y Y Y Y 2101 N N N N" Are you sure that this is the final result you want ? You could use the reshape

Re: [R] indicator or deviation contrasts in log-linear modelling

2009-02-19 Thread Michael Friendly
Maja, The need to interpret parameters in log-linear models (and therefore, the need to understand how the model is parameterized) often vanishes if you visualize the fitted model or the residuals in a mosaic display. e.g., ucb1 asserts Admit is jointly independent of Gender and Dept --- fits

Re: [R] Python and R

2009-02-19 Thread Esmail Bonakdarian
Hi Kenn, Thanks for the suggestions, I'll have to see if I can figure out how to convert the relatively simple call to lm with an equation and the data file to the functions you mention (or if that's even feasible). Not an expert in statistics myself, I am mostly concentrating on the programming

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread David Hajage
2009/2/19 baptiste auguie > Perhaps you can try this, > > d <- c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, >> 0.00380083, >> 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083, >> 0.00380083) >> >> c( t( cbind(matrix(d, ncol=3, byrow=T), 0))) >> >> > I don't k

Re: [R] Python and R

2009-02-19 Thread Esmail Bonakdarian
Doran, Harold wrote: lm(y ~ x-1) solve(crossprod(x), t(x))%*%y# probably this can be done more efficiently You could do crossprod(x,y) instead of t(x))%*%y that certainly looks more readable (and less error prone) to an R newbie like myself :-)

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread Eik Vettorazzi
to avoid the transposition you can use rbind(matrix(d, nrow=3), 0) baptiste auguie schrieb: Perhaps you can try this, d <- c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, 0.00380083, 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083, 0.00380083) c( t( cbin

Re: [R] Python and R

2009-02-19 Thread Esmail Bonakdarian
Gabor Grothendieck wrote: On Wed, Feb 18, 2009 at 7:27 AM, Esmail Bonakdarian wrote: Gabor Grothendieck wrote: See ?Rprof for profiling your R code. If lm is the culprit, rewriting your lm calls using lm.fit might help. Yes, based on my informal benchmarking, lm is the main "bottleneck", th

Re: [R] Unadulterated plot

2009-02-19 Thread Patrizio Frederic
James, as I previously told you in my broken English, probably the function you're looking for is not filled.contour but image and contour The following code makes exactly what you ask for data(akima) akima akima.smooth <- with(akima, interp(x, y, z, xo=seq(0,25, length=500),

Re: [R] error bars

2009-02-19 Thread hadley wickham
On Thu, Feb 19, 2009 at 1:19 AM, jdeisenberg wrote: > > > Nicole Hackman wrote: >> >> Hello, I have a very simple data set i imported from excel including 96 >> averages in a column along with 96 standard errors associated with those >> averages (calculated in excel). I plotted the 95 averages us

[R] Bug in predict function for naiveBayes?

2009-02-19 Thread joris meys
Dear all, I tried a simple naive Bayes classification on an artificial dataset, but I have troubles getting the predict function to work with the type="class" specification. With type= "raw", it works perfectly, but with type="class" I get following error : Error in as.vector(x, mode) : invalid '

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread baptiste auguie
Perhaps you can try this, d <- c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, 0.00380083, 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083, 0.00380083) c( t( cbind(matrix(d, ncol=3, byrow=T), 0))) I don't know how to avoid the transpose operation that m

Re: [R] type III effect from glm()

2009-02-19 Thread Mark Difford
Hi Simon, >> [On my response] ...not really a sensible question until... On reading through this...what I mean is that yours seems not to be a "sensible approach," the question itself may be reasonable. What you want to be doing is testing whether the interaction term (yrs:district) gets dropped

[R] Odp: problem with comparing a part of string with whole string

2009-02-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.02.2009 13:39:42: > Hi all, > > I got one problem with comparing strings like if any string is like > > "*RIGHT, EPICARDIUM: FOCUS, GRAY-WHITE, SINGLE, APPROX 0.6 CM IN DIAMETER*." > > and i have to compare "*GRAY-WHITE*"with the abo

Re: [R] problem with comparing a part of string with whole string

2009-02-19 Thread jim holtman
'grep' will tell you if there is a match in the string; > x <- c("*RIGHT, EPICARDIUM: FOCUS, GRAY-WHITE, SINGLE, APPROX 0.6 CM IN > DIAMETER*.","*MEDULLRY TUMOR BENIGN,TYP PHEOCHROMOCYTOMA*") > grep("GRAY-WHITE", x) [1] 1 > grep("TUMOR BENIGN", x) [1] 2 On Thu, Feb 19, 2009 at 7:39 AM, venkata k

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread jim holtman
How about this: > dat<-c(0.00377467,0.00377467,0.00377467,0.00380083,0.00380083,0.00380083,0.00380959, + 0.00380959,0.00380959,0.00380083,0.00380083,0.00380083) > dat[seq(1, by=3, to=length(dat))] <- 0 > dat [1] 0. 0.00377467 0.00377467 0. 0.00380083 0.00380083 0. 0.003809

  1   2   >