[R] How to take out the content of character string

2010-03-09 Thread jq81
My question is represented by the following example. For example, I have a character string a, which is defined as AA="list(x=1, y=2)" I want to take out the content of AA by using some function, so that I can obtain the following expression automatically. list(x=1, y=2) Does anyone know how

[R] Extract values of a two-factor table and duplicate them into a three-factor table

2010-03-09 Thread Melanie HAMEL
Dear all, I would like to solve a trivial problem (I guess it is) but can't find the right way. Maybe someone can help me ? I've got a table with two factors (station = station ID, buffer = buffer size in meters) and a value for each unique combination of those two factors (S = number of habit

[R] Installing mgarch package for Mac

2010-03-09 Thread mjlee818
Hi, I am a novice in R. I would like to use a package called "mgarch", but I have trouble installing it. It is not available on CRAN servers. I downloaded the tar.gz file online. (mgarch_0.00-1.tar.gz) I have tried to install it using the "Install Packages" module. I am not even sure if it is a b

[R] speed

2010-03-09 Thread Adam Majewski
Hi, I have found some example of R code : http://commons.wikimedia.org/wiki/File:Mandelbrot_Creation_Animation_%28800x600%29.gif When I run this code on my computer it takes few seconds. I wanted to make similar program in Maxima CAS : http://thread.gmane.org/gmane.comp.mathematics.maxima.gener

Re: [R] penalized maximum likelihood estimation and logistf

2010-03-09 Thread Ravi Varadhan
Hi, The problem is actually not in the parameter estimation, but in the confidence interval computation using the profile-likelihood method. This can be easily fixed, but the results may still be not sensible. So, the best thing to do would be to use the "Wald" confidence interval instead of

Re: [R] calling map() in xyplot()

2010-03-09 Thread David Winsemius
On Mar 9, 2010, at 10:42 PM, Gurmeet wrote: Hi All, I'm trying to add a map on the following lattice plot, but not correctly... can anyone help please... R Code: require(lattice) us.map <- map(plot = FALSE, fill = TRUE) Maybe you should explain why you think plotting quake locations nea

Re: [R] calling map() in xyplot()

2010-03-09 Thread Felix Andrews
It seems to draw some islands... looks OK to me... what exactly is the problem? Note, you probably want to specify aspect="iso" On 10 March 2010 14:42, Gurmeet wrote: > Hi All, > > I'm trying to add a map on the following lattice plot, but not correctly... > can anyone help please... > > R Cod

Re: [R] Fine Tuning Plotrix

2010-03-09 Thread Jim Lemon
On 03/10/2010 10:12 AM, Lorenzo Isella wrote: Dear All, Please see the code snippet at the end of the email. I am using the color2D.matplot in Plotrix to plot a matrix. It works great, but there are a few things I cannot figure out (1) the value of cex.axis in the code snippet does not seem to a

Re: [R] Help with ANOVA in R

2010-03-09 Thread Ravi Kulkarni
Your line of code: zzz.aov <- aov(Intensity ~ Group + Error(Sample), data = zzzanova) indicates that you are trying to do a repeated measures ANOVA, not just an ANOVA. The Error(Sample) term in your expression indicates that Sample is a within subjects factor, which I presume is not the case.

Re: [R] Obtaining the true aspect ratio for a lattice plot

2010-03-09 Thread Felix Andrews
Basically you want to achieve an aspect ratio of 0.5 (say) when specifying aspect = "fill". You can calculate the aspect ratio after a lattice plot has been displayed: currAspect <- function() { trellis.focus("panel", 1, 1, highlight = FALSE) sz <- current.panel.limits("mm") trellis.un

[R] calling map() in xyplot()

2010-03-09 Thread Gurmeet
Hi All, I'm trying to add a map on the following lattice plot, but not correctly... can anyone help please... R Code: require(lattice) us.map <- map(plot = FALSE, fill = TRUE) Depth <- equal.count(quakes$depth, number=8, overlap=.1) xyplot(lat ~ long | Depth, data = quakes, panel = function(..

Re: [R] Transfer R workspace on another PC

2010-03-09 Thread Khanh Nguyen
I don't have an answer, but I suggest 'session' package.. I use it to move my workspace around. Never had any problem before. -k On Tue, Mar 9, 2010 at 4:44 PM, Eleni Christodoulou wrote: > Hi list! > > I have recently tried to take my office work home, meaning that I tried to > transfer my "...

Re: [R] Scripts from The Elements of Statistical Learning book

2010-03-09 Thread David Winsemius
On Mar 9, 2010, at 6:59 PM, mramon wrote: Anyone know if it is possible to get the R scripts used in the "The Elements of Statistical Learning" book? It is a great book but sometimes some help would be useful to replicate the results presented in the book and so, understood things bette

Re: [R] Help with aggregate and cor

2010-03-09 Thread Ista Zahn
Hi James, It would really help if you gave us a sample of the data you are working with. The following is not tested, because I don't have your data and am too lazy to construct a similar example dataset for you, but it might get you started. You can try using a for loop along the lines of output

Re: [R] Importing Access 2007 data with ROBC

2010-03-09 Thread David Scott
Ryan Utz wrote: Hi all, I'm trying to import Microsoft Access data into R. It looks like I'm supposed to use the ROBC package, and this works fine with old Access files (those with an .mdb extension). However, lovely Microsoft must constantly update their software. Modern Access files have an .

[R] RMySQL_0.7-4 core dumped on dbWriteTable

2010-03-09 Thread Jay Castino
Good Afternoon: Have an R script that uses RMySQL package. Everything works great within 32 bit ubuntu linux environment (/usr/sbin/mysqld: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped). > mysqlClientLibraryVers

[R] Importing Access 2007 data with ROBC

2010-03-09 Thread Ryan Utz
Hi all, I'm trying to import Microsoft Access data into R. It looks like I'm supposed to use the ROBC package, and this works fine with old Access files (those with an .mdb extension). However, lovely Microsoft must constantly update their software. Modern Access files have an .ACCDB extension. I

Re: [R] ctree - party package multivariate response variables

2010-03-09 Thread Henric (Nilsson) Winell
On 2010-03-09 04:40, valeriano.parravic...@unige.it wrote: Hi, I have a problem with ctree of party package. I have data on distribution of more than one species (about 50 species) and I would like identify the relation of this multivariate object (species distribution) with a number of explanat

[R] Scripts from The Elements of Statistical Learning book

2010-03-09 Thread mramon
Anyone know if it is possible to get the R scripts used in the "The Elements of Statistical Learning" book? It is a great book but sometimes some help would be useful to replicate the results presented in the book and so, understood things better. Thanks Manuel -- View this message in context:

Re: [R] r code to generate interaction columns

2010-03-09 Thread kMan
Dear Dhruv, Your clarification helps, and I'm stumped. Sorry I cannot be of more help. Sincerely, KeithC. -Original Message- From: Sharma, Dhruv [mailto:dhruv.sha...@penfed.org] Sent: Monday, March 08, 2010 7:51 AM To: kMan; r-help@r-project.org Subject: RE: [R] r code to generate inter

[R] Help with aggregate and cor

2010-03-09 Thread James Marca
Hello, I do not understand the correct way to approach the following problem in R. I have observations of pairs of variables, v1, o1, v2, o2, etc, observed every 30 seconds. What I would like to do is compute the correlation matrix, but not for all my data, just for, say 5 minutes or 1 hour chun

Re: [R] Durbin-Watson

2010-03-09 Thread John Fox
Dear Dimitri, There's also dwtest() in the lmtest package, which is limited to the first-order DW statistic, but computes the p-value without simulation. Regards, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology Mc

Re: [R] Generating records from data frame

2010-03-09 Thread jim holtman
try this: > x <- data.frame(Name = c("a", "b", "c", "d"), Group = c("VR", "MR", "VR", + "LR"), Number = c(2, 3, 4, 2)) > x Name Group Number 1aVR 2 2bMR 3 3cVR 4 4dLR 2 > x.new <- x[rep(seq(nrow(x)), times=x$Number),] > x.new Name Group Nu

Re: [R] Durbin-Watson

2010-03-09 Thread Dimitri Liakhovitski
Never mind - I think I found it in "car" package. On Tue, Mar 9, 2010 at 8:08 PM, Dimitri Liakhovitski wrote: > Hello! > > I have run a regression using lm. > However, my data points are actually for different dates (weeks). How > could I calculate Durbin-Watson statistic for my regression model?

Re: [R] Help! I need to use R to calculate a recursive function!

2010-03-09 Thread Sharpie
anan1986 wrote: > > I tried! but my solution is not correc! > What is not correct? What did you try? You need to supply us with details! Specifically, the details that are mentioned in the posting guide for this mailing list: http://www.r-project.org/posting-guide.html "Data! Data! Data

[R] Durbin-Watson

2010-03-09 Thread Dimitri Liakhovitski
Hello! I have run a regression using lm. However, my data points are actually for different dates (weeks). How could I calculate Durbin-Watson statistic for my regression model? Thank you! D. -- Dimitri Liakhovitski Ninah.com dimitri.liakhovit...@ninah.com _

[R] Generating records from data frame

2010-03-09 Thread Steven Kang
Hi all, I wish to generate additional records according to one of the field values in a data frame. For example, unique record from the input data is required to be generated number of times as specified in the 'Number' field in the following code. > x <- data.frame(Name = c("a", "b", "c", "d"),

Re: [R] Help! I need to use R to calculate a recursive function!

2010-03-09 Thread GlenB
Please show your attempt that didn't work. What do you do for Z(1)? (You could try looking at the help on filter) -- View this message in context: http://n4.nabble.com/Help-I-need-to-use-R-to-calculate-a-recursive-function-tp1586189p1586777.html Sent from the R help mailing list archive at Na

Re: [R] looping through predictors

2010-03-09 Thread Dimitri Liakhovitski
Thank you very much- I found ?as.formula of great help! Dimitri On Tue, Mar 9, 2010 at 6:36 PM, David Winsemius wrote: > I already answered a very similar question earlier today. It was in the > context of a question about a different regression function, but the formula > methods are generic.

Re: [R] looping through predictors

2010-03-09 Thread David Winsemius
I already answered a very similar question earlier today. It was in the context of a question about a different regression function, but the formula methods are generic. Look for "Question on passing in parameter to Cox hazard". (That does not mean I approve of such fishing expeditions.) -

Re: [R] looping through predictors

2010-03-09 Thread Phil Spector
Dimitri - Without commenting on the wiseness of such an approach, here's one way to do what you want: regs = lapply(predictors,function(var)lm(data$y~data[,var])) names(regs) = predictors Now regs[['x1']] holds the lm output from the regression of y on x1, regs[['x2']] holds the lm output fr

[R] looping through predictors

2010-03-09 Thread Dimitri Liakhovitski
Dear R-ers, I have a data frame data with predictors x1 through x5 and the response variable y. I am running a simple regression: reg<-lm(y~x1, data=data) I would like to loop through all predictors. Something like: predictors<-c("x1","x2",... "x10) for(i in predictors){ reg<-lm(y~i) etc. } B

[R] Fine Tuning Plotrix

2010-03-09 Thread Lorenzo Isella
Dear All, Please see the code snippet at the end of the email. I am using the color2D.matplot in Plotrix to plot a matrix. It works great, but there are a few things I cannot figure out (1) the value of cex.axis in the code snippet does not seem to affect the final pdf at all (at least on my sys

Re: [R] Help! I need to use R to calculate a recursive function!

2010-03-09 Thread Barry Rowlingson
On Tue, Mar 9, 2010 at 9:06 PM, anan1986 wrote: > > I tried! but my solution is not correc! > -- > View this message in context: > http://n4.nabble.com/Help-I-need-to-use-R-to-calculate-a-recursive-function-tp1586189p1586590.html > Sent from the R help mailing list archive at Nabble.com. Then s

Re: [R] data frame select max group by like function

2010-03-09 Thread Tan, Richard
Thanks all for the help! -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Tuesday, March 09, 2010 5:58 PM To: Phil Spector; Tan, Richard Cc: r-help@r-project.org Subject: RE: [R] data frame select max group by like function And yet another way is > isLastInRun

Re: [R] data frame select max group by like function

2010-03-09 Thread William Dunlap
And yet another way is > isLastInRun <- function(x)c(x[-1]!=x[-length(x)], TRUE) > sortedDat <- dat[order(dat$ID,dat$score),] > sortedDat[isLastInRun(sortedDat$ID),] ID year score 5 mary 1998 100 2 rick 199490 1 tom 199588 The row names (5,2,1) show where in the origina

Re: [R] Transfer R workspace on another PC

2010-03-09 Thread Steve Lianoglou
Hi, On Tue, Mar 9, 2010 at 4:44 PM, Eleni Christodoulou wrote: > Hi list! > > I have recently tried to take my office work home, meaning that I tried to > transfer my "... .RData" workspace from my PC on my laptop. The office PC > runs on Windows XP and my laptop runs on Windows Vista. I have sav

[R] Tukey test for Mixed Effects Model with more than 1 fixed effect?

2010-03-09 Thread Melissa Evanson
I am trying to decipher, via post hoc test (Tukey), which of my sites differ from eachother. I have 4 sites, 2 sets of In vs Out (MPA) in separate Regions. Therefore my Mixed Effects Model code has 2 fixed effects: CB.lme <- lme(AsinCB~ In_Out*Region, random = (~1| site.trans/Quadrat) , data

Re: [R] Help! I need to use R to calculate a recursive function!

2010-03-09 Thread anan1986
I tried! but my solution is not correc! -- View this message in context: http://n4.nabble.com/Help-I-need-to-use-R-to-calculate-a-recursive-function-tp1586189p1586590.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.or

[R] TIBCO Spotfire 3.1 announced, featuring integration with R & S+

2010-03-09 Thread Louis Bajuk-Yorgan
TIBCO Software Inc. today launched TIBCO Spotfire 3.1, the latest version of its in-memory analytics platform, making predictive analytics based on R & S+ accessible within Spotfire's visual user experience. With this release, R & S+ users will be able to share and deploy their scripts through the

[R] coefficient standard errors in logistic GWR

2010-03-09 Thread MarcPadi
Dear all, I’m a PhD student on forestry and I would like to apply a logistic Geographically Weighted Regression (GWR) and use the standard errors of the parameter estimates. So far I’m able to run the GWR analysis with the “ggwr” function of the “spgwr” package but I don’t get the

[R] Obtaining the true aspect ratio for a lattice plot

2010-03-09 Thread Ryan Hafen
I almost always supply my own aspect ratio when plotting using lattice. When I plot these to pdf, I would like to specify pdf dimensions that will result in minimal margins around the plot. In my application, resorting to a pdf cropper after plotting is not an option - I must do it in R.

[R] chairs for stat computing sessions at JSM

2010-03-09 Thread Thomas Lumley
Hi all, Apologies to people who get more than one of these requests, or who don't go to the Joint Statistical Meetings. I'm looking for chairs for about a dozen contributed paper sessions sponsored by the ASA section on statistical computing at the Joint Statistical Meetings in Vancouver thi

Re: [R] black cluster in salt and pepper image

2010-03-09 Thread Carl Witthoft
You might also want to look at the ImageJ application, http://rsb.info.nih.gov/ij/ which IIRC has a bunch of tools designed to pick out clusters, dots, etc. Carl __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] Monetary support to the R-project (Was: Re: Executable for Production Use)

2010-03-09 Thread Tal Galili
I would second the request/ be curious to know if this might be implemented. Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www

Re: [R] Transfer R workspace on another PC

2010-03-09 Thread Tal Galili
Hi Eleni, I have no answers, but a few questions: 1) What is the size of the Rdata ? 2) Did you try to restart the computer and then load the file again (it solved the problem for me once). 3) Is this you first attempt, or did you manage to do it in the past and only now failed ? Best, Tal --

Re: [R] ks.test; memory problems

2010-03-09 Thread jim holtman
You will probably need a 64-bit version of R, but you are running on Windows and I think there is only a beta version available there. I ran this on my 32-bit Window version to generate 1M indices into your sample space; your could use this to get the data off a database or there is a package for

[R] Transfer R workspace on another PC

2010-03-09 Thread Eleni Christodoulou
Hi list! I have recently tried to take my office work home, meaning that I tried to transfer my "... .RData" workspace from my PC on my laptop. The office PC runs on Windows XP and my laptop runs on Windows Vista. I have saved the workspace at the office PC and kept it in a usb drive. When I tried

Re: [R] ks.test; memory problems

2010-03-09 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jonathan > Sent: Tuesday, March 09, 2010 1:28 PM > To: r-help > Subject: Re: [R] ks.test; memory problems > > Furthermore, I am not even able to take a sample of my large vector

Re: [R] Question on passing in parameter to Cox hazard

2010-03-09 Thread David Winsemius
On Mar 9, 2010, at 4:19 PM, Tim Smith wrote: Hi, I wanted to do the cox model using a matrix. The following lines illustrate what I want to do: dat <- matrix(rnorm(30), ncol=3,dimnames = list(1:10,letters[1:3])) Survival <- rexp(10) Status <- ifelse(runif(10

Re: [R] ks.test; memory problems

2010-03-09 Thread Jonathan
Furthermore, I am not even able to take a sample of my large vector (which does exist somehow and is in memory): > sampleOfBigVector <- c(range(myBigVector),sample(myBigVector, 1000)) Error: cannot allocate vector of size 718.0 Mb I guess I don't know what else I can do now, except find some clu

[R] Question on passing in parameter to Cox hazard

2010-03-09 Thread Tim Smith
Hi, I wanted to do the cox model using a matrix. The following lines illustrate what I want to do: dat <- matrix(rnorm(30), ncol=3,dimnames = list(1:10,letters[1:3])) Survival <- rexp(10) Status <- ifelse(runif(10) < .7, 1, 0) mat <- as.data.frame(cbind(dat,Surviv

[R] ks.test; memory problems

2010-03-09 Thread Jonathan
Hi R-help, I am interested in comparing two vectors of data observations to see if they come from the same distrubution (and have settled on the Kolmogorov-Smirnov test to do this).. I'd prefer to use all my data points, but computationally speaking, this is proving to be troublesome due to th

Re: [R] IMPORTANT - Add a plot to another plot

2010-03-09 Thread Greg Snow
Look at the subplot function in the TeachingDemos package, does that do what you want? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- >

Re: [R] data frame select max group by like function

2010-03-09 Thread Gabor Grothendieck
Try this. The aggregate call gives a data frame with the ID and max score. Then we merge that back with the original data frame so that we pick up the year too: merge(DF, aggregate(DF['score'], DF['ID'], max)) On Tue, Mar 9, 2010 at 1:35 PM, Tan, Richard wrote: > Hi, I have a data frame with 3

Re: [R] MASS package not on CRAN ?

2010-03-09 Thread Ista Zahn
MASS is a recommended package, so is probably already installed on your machine. Try library(MASS) -Ista On Tue, Mar 9, 2010 at 9:32 AM, Markus Loecher wrote: > The MASS package is listed on the CRAN web site ( > http://cran.r-project.org/web/packages/MASS/index.html) but I am unable to > insta

Re: [R] data frame select max group by like function

2010-03-09 Thread Phil Spector
Yet another way to do this with base R: dat = read.csv(textConnection('ID, year, score + tom, 1995, 88 + rick, 1994, 90 + mary, 2000, 97 + tom, 1998, 60 + mary, 1998,100')) do.call(rbind,lapply(split(dat,dat$ID),function(x)x[which.max(x$score),])) ID year score mary mary 1998 100 ric

[R] March-April 2010*** R / S+ Essentials and Advanced Courses*** by XLSolutions Corp in San Francisco and other USA cities

2010-03-09 Thread s...@xlsolutions-corp.com
Now available online is our March-April R / S+ Essentials and Advanced courses schedule in San Francisco and other USA cities http://www.xlsolutions-corp.com/Rcourses *** S-PLUS / R : Programming Essentials *** R Fundamentals and Programming Techniques *** R/S-PLUS Functions by Example. *** S

Re: [R] Moving Average Model

2010-03-09 Thread David Winsemius
On Mar 9, 2010, at 2:42 PM, David Winsemius wrote: On Mar 9, 2010, at 1:54 PM, testuser wrote: Using the forecast package in R, auto.arima returns a model of type (0,0,3) with coefficients. To forecast the value at any point of time t, I can use the coefficients along with the white noi

Re: [R] Cox Calibration regression test & double graphs

2010-03-09 Thread Frank E Harrell Jr
See the calibrate.* functions and the val.surv (for external validation) functions in the rms package. Note especially the new continuous calibration curve methods using hazard spline regression. Frank David Winsemius wrote: A) Please do not highjack threads. Post new topics for new questio

Re: [R] Moving Average Model

2010-03-09 Thread David Winsemius
On Mar 9, 2010, at 1:54 PM, testuser wrote: Using the forecast package in R, auto.arima returns a model of type (0,0,3) with coefficients. To forecast the value at any point of time t, I can use the coefficients along with the white noise values e(t). How can we get the value for white

Re: [R] Shade area under curve

2010-03-09 Thread Stephan Kolassa
Hi, use dnorm() for the density and polygon() to shade the area underneath, with suitably many x values so your density looks smooth. HTH, Stephan claytonmccandless schrieb: I want to shade the area under the curve of the standard normal density. Specifically color to the left of -2 and on.

Re: [R] data frame select max group by like function

2010-03-09 Thread Bert Gunter
An alternative base R version: ?by by(Dat,Dat$ID,function(frm)frm$year[which.max(frm$score)]) by() is a wrapper for tapply(), one of the base R "apply" family of functions (lapply, mapply, etc.) for which many find the plyr package provides a simpler and more consistent interface. I'm used to th

Re: [R] How To Display Current/Next Line Using browser()

2010-03-09 Thread Duncan Murdoch
On 09/03/2010 1:45 PM, xallanmillerx wrote: Hi, I'm running R 2.10 on a Linux console, inserted a call to browser() in an R script that I source() form the R command line. Two quick questions: (1) Once you are in the "browser prompt," is there any way to display the current/next line to be exe

Re: [R] rcom package

2010-03-09 Thread Albert-Jan Roskam
Hi Erich and Gabor, Thank you for your replies. I wanted to write *only* non-formulae cells. I have dozens of sheets with a mix of raw input (ie, no formulae) en calculated values. I want to separate this, In a later stage, I want to let R do all the calculations that with the current system ar

[R] Moving Average Model

2010-03-09 Thread testuser
Using the forecast package in R, auto.arima returns a model of type (0,0,3) with coefficients. To forecast the value at any point of time t, I can use the coefficients along with the white noise values e(t). How can we get the value for white noise? -- View this message in context: http://n4.nab

[R] Shade area under curve

2010-03-09 Thread claytonmccandless
I want to shade the area under the curve of the standard normal density. Specifically color to the left of -2 and on. How might i go about doing this? Thanks -- View this message in context: http://n4.nabble.com/Shade-area-under-curve-tp1586439p1586439.html Sent from the R help mailing list arc

[R] How To Display Current/Next Line Using browser()

2010-03-09 Thread xallanmillerx
Hi, I'm running R 2.10 on a Linux console, inserted a call to browser() in an R script that I source() form the R command line. Two quick questions: (1) Once you are in the "browser prompt," is there any way to display the current/next line to be executed without executing it? I can issue an "

Re: [R] Executable for Production Use

2010-03-09 Thread Uwe Ligges
On 08.03.2010 22:13, Stefan wrote: Ma Ismail - NewYork-MEAG-NY meag-ny.com> writes: Hi, A few of the developers on our Quant team are using R for data calculation andto generate a resulting CSV file. They have R installed on their workstations. We are interested in having this deployed t

Re: [R] data frame select max group by like function

2010-03-09 Thread Peter Ehlers
I find ddply() in package plyr handy for this sort of thing: library(plyr) f <- function(x) x[which.max( x[["score"]] ), ] ## x will be a subset of Dat according to ID ddply(Dat, "ID", f) -Peter Ehlers On 2010-03-09 11:59, Ista Zahn wrote: Hi Richard, There are probably better ways, bu

Re: [R] data frame select max group by like function

2010-03-09 Thread Ista Zahn
Hi Richard, There are probably better ways, but here is one approach: Dat <- read.table(textConnection("ID, year, score tom, 1995, 88 rick, 1994, 90 mary, 2000, 97 tom, 1998, 60 mary, 1998,100"), header=TRUE, sep=",") MaxScore <- aggregate(Dat$score, list(Dat$ID), max) names(MaxScore) <- c("ID",

Re: [R] data frame select max group by like function

2010-03-09 Thread Henrique Dallazuanna
Try this: library(sqldf) sqldf("SELECT ID, Year, MAX(score) FROM DF GROUP BY ID") Or do.call(rbind, lapply(split(DF <- DF[order(DF$score),], DF$ID), tail, 1)) On Tue, Mar 9, 2010 at 3:35 PM, Tan, Richard wrote: > Hi, I have a data frame with 3 columns: ID, year and score.  How can I > select f

Re: [R] sorting data whilst ignoring NA's

2010-03-09 Thread Peter Ehlers
On 2010-03-09 9:57, emwater wrote: Hello, I am very new to R and have hit my first main problem that I hope someone can easily resolve. I have some data that looks like this (there are 20,000 rows): qdata day month yearflow [1,] 210 1945 NA [2,] 310 194

Re: [R] sorting data whilst ignoring NA's

2010-03-09 Thread David Winsemius
On Mar 9, 2010, at 11:57 AM, emwater wrote: Hello, I am very new to R and have hit my first main problem that I hope someone can easily resolve. I have some data that looks like this (there are 20,000 rows): qdata day month yearflow [1,] 210 1945 NA [2,] 3

Re: [R] Cox Calibration regression test & double graphs

2010-03-09 Thread David Winsemius
A) Please do not highjack threads. Post new topics for new questions. B) Calibration plots are very easy for either logistic regression or Cox models when using the calibrate function in either Harrell's rms or Design packages. (Not sure about how well they play with survfit objects, but yo

[R] data frame select max group by like function

2010-03-09 Thread Tan, Richard
Hi, I have a data frame with 3 columns: ID, year and score. How can I select for each unique ID, the year that has the max score? For example, for data frame ID, year, score tom, 1995, 88 rick, 1994, 90 mary, 2000, 97 tom, 1998, 60 mary, 1998,100 I shall have ID, year, score tom, 1995, 88 ric

Re: [R] Help! I need to use R to calculate a recursive function!

2010-03-09 Thread Barry Rowlingson
On Tue, Mar 9, 2010 at 4:01 PM, anan1986 wrote: > > hi,all > > Z(i)=0.05X(i)+0.95Z(i-1), where i = 1.32, and X's are given data, the > question is how to use r to get the 32 values of Z. > > I couldn't do this in R and wish somebody can help me. Can you do anything in R? Have you tried? Have

[R] plotlmer graphics/x-axis and legend options

2010-03-09 Thread Sandra . Schwab
Hi, I am Using R.2.9.2 and I am trying to make nicer some graphics, which are constructed with plotmer.fnc. In particular, I have two questions: 1. Is is a way to decide in which order we want the labels on the x-axis. For now, the reference value label is the first one, and the other lab

Re: [R] penalized maximum likelihood estimation and logistf

2010-03-09 Thread xiaoyan yu
Thanks for your help. I can follow your explanation. Have you tried logistf and met the same problem? Are there any ways to locate which part of data causes the failure or other R code to build the model from the data? Thanks Xiaoyan On Tue, Mar 9, 2010 at 12:22 PM, Ravi Varadhan wrote: > > Le

Re: [R] Monetary support to the R-project (Was: Re: Executable for Production Use)

2010-03-09 Thread Jaroslaw Piskorski
I would have become a member a long time ago if the money transfer process was more standard. I am not comfortable sending the details of my credit card via snail-mail or fax. Perhaps you could set up a proper Internet service or give people the chance to pay by paypal? I realize that could mea

Re: [R] Is it possible to recursively update a function?

2010-03-09 Thread Seeker
Thanks for the input, Uwe. Unfortunately, I need to iteratively update functions from f1 to f25. Seems I have no choice but set each one manually. On Mar 6, 11:45 am, Uwe Ligges wrote: > It is not obvious to me if you can calculate f1, ..., f4, ... > automatically or have to set them manually. Lo

[R] Help! I need to use R to calculate a recursive function!

2010-03-09 Thread anan1986
hi,all Z(i)=0.05X(i)+0.95Z(i-1), where i = 1.32, and X's are given data, the question is how to use r to get the 32 values of Z. I couldn't do this in R and wish somebody can help me. thanks in regards -- View this message in context: http://n4.nabble.com/Help-I-need-to-use-R-to-calcul

[R] sorting data whilst ignoring NA's

2010-03-09 Thread emwater
Hello, I am very new to R and have hit my first main problem that I hope someone can easily resolve. I have some data that looks like this (there are 20,000 rows): > qdata day month yearflow [1,] 210 1945 NA [2,] 310 1945 NA [3,] 410 1945 NA

Re: [R] error in a function

2010-03-09 Thread jim holtman
Print out the 'str' of the two objects and look at it. Are the matrices the appropriate sizes to do the operation? The error message indicates they are not. This is an opportunity to learn how to debug a function. Look at the 'debug' package. On Tue, Mar 9, 2010 at 5:59 AM, weltbewohnerin1 < f

[R] Cox Calibration regression test & double graphs

2010-03-09 Thread paaventhan jeyaganth
Dear All, How can i do the bootstrap and calibration plot after surival analysis , i don't know how to do it after that please help me. Thanks here is my syntex library(survival) mfit <- survfit(Surv(days, status == 1)~drug, data = melanom) #how can i do the bootstra #Cox Calibratio

Re: [R] R package pdf files

2010-03-09 Thread Duncan Murdoch
On 09/03/2010 9:28 AM, Markus Loecher wrote: Dear all, the examples in the pdf files that are automatically built from the examples in package help files are poorly formatted; they frequently do not wrap to the next line and are cut off. While there is an easy work around by looking at the exampl

Re: [R] Help with adding points to allEffects plot

2010-03-09 Thread Peter Ehlers
As you can see on ?effects help page, plot.eff() uses lattice graphics. You can't mix those with traditional graphics commands. This should work: plot(allEffects(GSMOD), ask=FALSE) trellis.focus("panel", 1, 1) panel.points(y, x) trellis.unfocus() -Peter Ehlers On 2010-03-09 9:37, Grant G

Re: [R] using near-zero probabilities in optimization

2010-03-09 Thread Ben Bolker
Benedikt Gehr ieu.uzh.ch> writes: > > Hi there > > I am using mle2 for a multinomial likelihood optimization problem. My > function works fine when I'm using simulated data, however my cell > probabilities of the true data for the multinomial likelihood are > sometimes very small (in some ca

Re: [R] penalized maximum likelihood estimation and logistf

2010-03-09 Thread Ravi Varadhan
Let us look at a piece of the relevant code from "logistf" package: iter <- iter + 1 XW2 <- crossprod(x, diag(pi * (1 - pi))^0.5) Fisher <- crossprod(t(XW2)) covs <- solve(Fisher) H <- crossprod(XW2, covs) %*% XW2 if (firth) U.star <- c

Re: [R] Deltas or changes

2010-03-09 Thread Ben Bolker
Henrique Dallazuanna gmail.com> writes: > Reduce("/", as.data.frame(embed(x, 2))) > > ManInMoon googlemail.com> wrote: > > > > How can I generate a vector of differences between each > elemtn of an vector? (you mean ratios, right?) > > > > i.e. a[i]=x[i]/x[i-1] x[-1]/x[-length(x)] mig

Re: [R] Computation of AIC for gls models

2010-03-09 Thread Ben Bolker
Miguel Angel Rodríguez-Gironés Arbolí eeza.csic.es> writes: > > Dear Colleagues, > > We are using the phylog.gls.fit() function from the R package > "PHYLOGR" (Diaz-Uriarte R, Garland T: > PHYLOGR: Functions for phylogenetically based statistical > analyses. 2007. [snip] > ... we would wa

Re: [R] IMPORTANT - To remove the null elements from a vector

2010-03-09 Thread Matthew Dowle
Welcome to R Barbara. Its quite an incredible community from all walks of life. Your beginner questions are answered in the manual. See Introduction to R. Please read the posting guide again because it contains lots of good advice for you. Some people read it three times before posting because

Re: [R] Deltas or changes

2010-03-09 Thread Karl Ove Hufthammer
On Tue, 9 Mar 2010 05:37:52 -0800 (PST) ManInMoon wrote: > How can I generate a vector of differences between each elemtn of an vector? diff(x) -- Karl Ove Hufthammer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] A list of data.frames merged together

2010-03-09 Thread Phil Spector
Daniel - Reduce may be handy here: ans = Reduce(function(a,b)merge(a,b,by=1),yoda) names(ans)[2:ncol(ans)] = names(yoda) - Phil Spector Statistical Computing Facility Depa

[R] Possible error in anova.lm?

2010-03-09 Thread rkevinburton
Perhaps those more in the know than I could clarify some confusion. In the ANOVA 'R' code I see: mss <- sum(if (is.null(w)) object$fitted.values^2 else w * object$fitted.values^2) if (ssr < 1e-10 * mss) warning("ANOVA F-tests on an essentially perfect fit are unreliable"

[R] MASS package not on CRAN ?

2010-03-09 Thread Markus Loecher
The MASS package is listed on the CRAN web site ( http://cran.r-project.org/web/packages/MASS/index.html) but I am unable to install it via install.packages(). The error is that the package is "unavailable". When I manually download the source tar ball and try to install it on a Linux machine, inst

[R] Help with adding points to allEffects plot

2010-03-09 Thread Grant Gillis
Thanks in advance for any help. I am attempting to add points to a plot using the allEffects command in the effects package. When I try to add the points I get the following error message: Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet Strangely, using

[R] R package pdf files

2010-03-09 Thread Markus Loecher
Dear all, the examples in the pdf files that are automatically built from the examples in package help files are poorly formatted; they frequently do not wrap to the next line and are cut off. While there is an easy work around by looking at the examples in the corresponding help files, I do wonder

Re: [R] A list of data.frames merged together

2010-03-09 Thread Gabor Grothendieck
This will do it: > merge(A, B, by = 1, all = TRUE) Date Value.x Value.y 1 03/15/10 1 5 2 04/15/10 2 5 3 05/15/10 3 NA 4 06/15/10 NA 5 but you probably really want to be using time series for this so that you can easily perform other operations t

Re: [R] rcom package

2010-03-09 Thread Erich Neuwirth
rcom allows you to access the full object model of any COM server. The object browser in Excel allows you to investigate Excel's object model. It also tells you which properties are accessible. There are a few hundreds of them. On 3/9/2010 4:35 PM, Albert-Jan Roskam wrote: > Hi, > > I would

  1   2   >