Re: [R] subsetting without losing the attributes

2012-07-18 Thread Rui Barradas
Hello, Another quote from the help pages that could be usefull is, from ?subset, Warning This is a convenience function intended for use interactively. For programming it is better to use the standard subsetting functions like [, and in particular the non-standard evaluation of argument subse

[R] PCA

2012-07-18 Thread Guforu
Hi everybody! I do at this time PCA. Everything was going good, I have got good results. Now I want make a plot. You can see it on the next image: http://r.789695.n4.nabble.com/file/n4636840/Forum.jpg For this plot I use the simple biplot function. Now, it is not exactly what I want. I prefer t

[R] NTH PERCENTILE COULMNWIESE

2012-07-18 Thread Rantony
Hi, Here i have an matrix mydat <- ABCXYZ - -- 12 6 6 50 90 100 55 85 100 25 i need to find the " NTH percentile " [result should be in column-wise]. here i have a code for NTH percenile, For eg:- if i need 20th-percentile then, qu

Re: [R] "duplicate couples (time-id)" Problem

2012-07-18 Thread Saint
Thank you! Problem solved! There where two identical observations. -- View this message in context: http://r.789695.n4.nabble.com/duplicate-couples-time-id-Problem-tp4636316p4636841.html Sent from the R help mailing list archive at Nabble.com. __ R-he

Re: [R] complexity of operations in R

2012-07-18 Thread Patrick Burns
It looks to me like the following should do what you want: f2 <- function(dotot) array(FALSE, c(dotot, 1)) What am I missing? Pat On 17/07/2012 21:58, Johan Henriksson wrote: thanks for the link! I should read it through. that said, I didn't find any good general solution to the problem so he

Re: [R] OT: Where's the new Tukey?

2012-07-18 Thread Liviu Andronic
On Wed, Jul 18, 2012 at 12:30 AM, Kjetil Halvorsen wrote: > Venables & Ripley: > "Modern Applied Statistics with S (fourth Edition)" > [..] > > On Sat, Jul 14, 2012 at 4:01 PM, Larry White wrote: >> I'm looking for a single book that provides a deep, yet readable >> introduction to applied data a

[R] duplicate data between two data frames according to row names

2012-07-18 Thread jeff6868
Hi everybody. I'll first explain my problem and what I'm trying to do. Admit this example: I'm working on 5 different weather stations. I have first in one file 3 of these 5 weather stations, containing their data. Here's an example of this file: DF1 <- data.frame(station=c("ST001","ST004","ST00

Re: [R] Regression Identity

2012-07-18 Thread peter dalgaard
On Jul 18, 2012, at 05:11 , darnold wrote: > Hi, > > I see a lot of folks verify the regression identity SST = SSE + SSR > numerically, but I cannot seem to find a proof. I wonder if any folks on > this list could guide me to a mathematical proof of this fact. > Wrong list, isn't it? http://

Re: [R] problem with function

2012-07-18 Thread Rui Barradas
Hello, I believe that the answer to your final question is yes but you are making a really big confusion of what you want, of how you are explaining it and of the way R works. First, I have written a function to read the data from the post, without creating a disk file. In order to be comple

Re: [R] NTH PERCENTILE COULMNWIESE

2012-07-18 Thread Rui Barradas
Hello, Try the following. colQuant <- function(x, probs= seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7, ...){ apply(x, 2, quantile, probs = probs, na.rm = na.rm, names = names, type = type, ...) } mat <- matrix(rnorm(12), 4) colQuant(mat, 0.20) colQuant(mat, c(0.20, 0.5))

Re: [R] complexity of operations in R

2012-07-18 Thread Rui Barradas
Hello, Em 18-07-2012 09:06, Patrick Burns escreveu: It looks to me like the following should do what you want: f2 <- function(dotot) array(FALSE, c(dotot, 1)) What am I missing? That matrix is even faster? f2 <- function(dotot) array(FALSE, c(dotot, 1)) f3 <- function(dotot) matrix(FALSE,

Re: [R] TRUE/FALSE

2012-07-18 Thread Jim Lemon
On 07/17/2012 11:55 PM, cm wrote: Any reason I'd get an error like this? Error in if (round(pos[o + 1]) == (pos[o + 1] - 0.4)) { : missing value where TRUE/FALSE needed but when i do it individually, out of the for loop, (round(pos[o+1])==(pos[o+1]-.4) ) 65 TRUE Elementary, my dear cm.

Re: [R] duplicate data between two data frames according to row names

2012-07-18 Thread Eik Vettorazzi
Hi Jeff, looks like a job for ?rbind and ?merge merge(rbind(DF1,DF2),DF3) hth Am 18.07.2012 10:21, schrieb jeff6868: > Hi everybody. > > I'll first explain my problem and what I'm trying to do. > Admit this example: > I'm working on 5 different weather stations. > I have first in one file 3 o

[R] contour

2012-07-18 Thread Akhil dua
Hello Everyone I have the data long format and I want to draw the contour plot with it x1 x2 x3 0 12 0 21 0 35 1 14 1 22 1 33 when I am using contour(x1,x2,x3,col=heat.colors) or fill.contour its giving me an error that increasing x and y expected So please

Re: [R] complexity of operations in R

2012-07-18 Thread Prof Brian Ripley
On 18/07/2012 09:49, Rui Barradas wrote: Hello, Em 18-07-2012 09:06, Patrick Burns escreveu: It looks to me like the following should do what you want: f2 <- function(dotot) array(FALSE, c(dotot, 1)) What am I missing? That matrix is even faster? Depends on your unstated version of R

Re: [R] Imposing more than one condition to if

2012-07-18 Thread Rui Barradas
hELLO, There was no nedd to change the names of the variables inside the fucntion. What was going on s that in this new file column 'dtime' doesn't exist. Since column 'clock' exists in all files, I've changed the function once again, making it more general. Note that there is an argument 'c

Re: [R] Problem creation tensor

2012-07-18 Thread Petr Savicky
On Tue, Jul 17, 2012 at 12:31:38PM +0200, Peppe Ricci wrote: > Hi guys, > > I need some help to analyzing my data. > I start to describe my data: I have 21 matrices, every matrix on the > rows has users and on columns has items, in my case films. > Element of index (i, j) represent the rating expr

Re: [R] Problem creation tensor

2012-07-18 Thread Petr Savicky
On Wed, Jul 18, 2012 at 11:38:59AM +0200, Petr Savicky wrote: > On Tue, Jul 17, 2012 at 12:31:38PM +0200, Peppe Ricci wrote: > > Hi guys, > > > > I need some help to analyzing my data. > > I start to describe my data: I have 21 matrices, every matrix on the > > rows has users and on columns has it

[R] 'symbols' not plotting correct circle radii

2012-07-18 Thread Stuart Leask
Hi there. I have been plotting some circles using 'symbols', with radii representing my data, but the radii looked incorrect. It seems to happen with a single circle too: Symbols ( 0, 0, circles = 40, xlim = c(-40, 40), ylim= c(-40, 40)) If I put a ruler up to my monitor (technology!) to co

Re: [R] contour

2012-07-18 Thread Rui Barradas
Hello, Follow the code below and see what's the right way: d <- read.table(text=" x1 x2 x3 0 12 0 21 0 35 1 14 1 22 1 33 ", header=TRUE) x3 <- matrix(d[, "x3"], ncol=2) levels <- sort(unique(x3)) contour(0:1, 1:3, t(x3), levels=levels) Hope this helps, Ru

Re: [R] duplicate data between two data frames according to row names

2012-07-18 Thread jeff6868
"merge" is enough for me, thanks! I was thinking about a loop, or a function like "grep", or maybe another function. I'll have to think easier next time! Thanks again! -- View this message in context: http://r.789695.n4.nabble.com/duplicate-data-between-two-data-frames-according-to-row-names-tp4

Re: [R] Problem creation tensor

2012-07-18 Thread GMailPegasus
what is the problem? gr -Messaggio originale- From: Kjetil Halvorsen Sent: Wednesday, July 18, 2012 1:01 AM To: Peppe Ricci Cc: r-help@r-project.org Subject: Re: [R] Problem creation tensor Amusing that someone named RICCI is asking about tensors (sorry!) Kjetil On Tue, Jul 17,

Re: [R] 'symbols' not plotting correct circle radii

2012-07-18 Thread Jim Lemon
On 07/18/2012 08:02 PM, Stuart Leask wrote: Hi there. I have been plotting some circles using 'symbols', with radii representing my data, but the radii looked incorrect. It seems to happen with a single circle too: Symbols ( 0, 0, circles = 40, xlim = c(-40, 40), ylim= c(-40, 40)) If I put a

[R] How to have original (name) order after melt and cast command

2012-07-18 Thread Vincy Pyne
Dear R helpers, I have a data.frame as given below - dat1 = data.frame(date = as.Date(c("3/30/12","3/29/12","3/28/12","3/27/12","3/26/12", "3/23/12","3/22/12","3/21/12","3/20/12", "3/30/12","3/29/12","3/28/12","3/27/12", "3/26/12","3/23/12","3/22/12","3/21/12","3/20/12", "3/30/12","3/29/12","3

Re: [R] contour

2012-07-18 Thread Eik Vettorazzi
Hi Akhil, in addition to Rui's post, here is a solution using lattice graphics. tmp<-read.table(textConnection("x1 x2 x3 0 12 0 21 0 35 1 14 1 22 1 33"),header=T) library(lattice) contourplot(x3~x1*x2,tmp) hth. Am 18.07.2012 11:23, schrieb Akhil dua: > Hello

Re: [R] contour

2012-07-18 Thread Rui Barradas
Hello, Now I don't understand. Inline Em 18-07-2012 11:56, Akhil dua escreveu: why are you writing ncol=2 ? I have levels=100 for x1 and the x1 is my z matrix In your contour instruction x3 is the z matrix, not x1. And your dataset shows a 2x3 grid, hence ncol=2, for (x1 times x2) 0:1x1:3.

[R] Mean of matched data

2012-07-18 Thread robgriffin247
Hi I think/hope there will be a simple solution to this but google-ing has provided no answers (probably not using the right words) I have a long data frame of >2 000 000 rows, and 6 columns. Across this there are 24 000 combinations of gene in a column (n=12000) and gender in a column (n=2... obv

[R] check whether connection can be opened

2012-07-18 Thread Berry Boessenkool
Hi all, I'm working on a function that reads online data that is only available to certain IPs. It then writes a subset of the data into a file. So whenever I'm logged in elsewhere or am not connected to the internet, I get an error, and the function is terminated. I want it to rather print a

Re: [R] How to have original (name) order after melt and cast command

2012-07-18 Thread Vincy Pyne
Dear Mr Rui Barradas, Thanks a lot for your wonderful suggestion. It worked and will help me immensely in future too. Really heartfelt thanks once again. Vincy --- On Wed, 7/18/12, Rui Barradas wrote: From: Rui Barradas Subject: Re: [R] How to have original (name) order after melt and cast c

Re: [R] How to have original (name) order after melt and cast command

2012-07-18 Thread Rui Barradas
Hello, Try the following. # This is your code df_sorted = df[order(as.Date(df$date, "%m/%d/%Y"), decreasing = TRUE),] # This is my code nams <- as.character(unique(dat1$name)) nums <- sapply(nams, function(nm) which(names(df_sorted) %in% nm)) df_sorted[, sort(nums)] <- df_sorted[, nams] names(d

Re: [R] Mean of matched data

2012-07-18 Thread Rui Barradas
Helo, All problems should be easy. d <- read.table(text=" gene variable value gender line rep 1 CG1 X208.F1.30456 4.758010 Female 208 1 2 CG1 X365.F2.30478 4.915395 Female 365 2 3 CG1 X799.F2.30509 4.641636 Female 799 2 4 CG1 X306.M2.32650 4.550676 Male 306 2 5 CG1 X712.M2.3

Re: [R] 'symbols' not plotting correct circle radii

2012-07-18 Thread Sarah Goslee
On Wed, Jul 18, 2012 at 6:42 AM, Jim Lemon wrote: > On 07/18/2012 08:02 PM, Stuart Leask wrote: >> >> Hi there. >> >> I have been plotting some circles using 'symbols', with radii representing >> my data, but the radii looked incorrect. >> >> It seems to happen with a single circle too: >> >> Symb

Re: [R] 'symbols' not plotting correct circle radii

2012-07-18 Thread Jim Lemon
On 07/18/2012 09:42 PM, Sarah Goslee wrote: On Wed, Jul 18, 2012 at 6:42 AM, Jim Lemon wrote: On 07/18/2012 08:02 PM, Stuart Leask wrote: Hi there. I have been plotting some circles using 'symbols', with radii representing my data, but the radii looked incorrect. It seems to happen with a s

Re: [R] order or sort doesn´t work properly

2012-07-18 Thread Jean V Adams
# MCT ordered by the second column of MCT, from smallest to largest values MCT[order(MCT[, 2]), ] Jean Trying To learn again wrote on 07/17/2012 04:42:24 PM: > Hi all, > > I want to order a series that is included on the second column in MCT.csv. > > I do but R doesn´t order, could be beca

Re: [R] 'symbols' not plotting correct circle radii

2012-07-18 Thread Jim Lemon
On 07/18/2012 10:11 PM, Jim Lemon wrote: On 07/18/2012 09:42 PM, Sarah Goslee wrote: On Wed, Jul 18, 2012 at 6:42 AM, Jim Lemon wrote: On 07/18/2012 08:02 PM, Stuart Leask wrote: Hi there. I have been plotting some circles using 'symbols', with radii representing my data, but the radii looke

Re: [R] Variable labels

2012-07-18 Thread Nutter, Benjamin
I have my own function for doing this that is similar to the one presented below. Others may have other ideas that work better. As a general rule, I would caution against writing out just the label without the variable name. The only reason I see to separate the labels and names is if you are

[R] Skip file

2012-07-18 Thread bunnylover23
What i have is a for loop to name files. I want it to skip over the file if it doesn't exist. Is there a way to do that? s=seq(from = chron("03/15/2012"), to = chron("06/15/2012")) day=format(as.Date(s), "%Y%m%d") for (k in 1:length(day)){ B1=read.csv(paste("S:/file_", day[k], ".csv", sep="")) Da

[R] contour lines with number labels in lattice?

2012-07-18 Thread Martin Ivanov
Dear R users, I am new to lattice but am trying to get to grips with it. I need to add contour lines for the topography to a plot I created with spplot. The topography is available as a SpatialPixelsDataFrame object Z_sfc. If I plot it as spatial lines, after converting to a SpatialLines objec

[R] Building a web risk calculator based on Cox, PH--definitive method for calculating probability?

2012-07-18 Thread Terry Therneau
Here is an example of how to do it. > library(survival) > vfit <- coxph(Surv(time, status) ~ celltype + trt, data=veteran) > userinput <- data.frame(celltype="smallcell", trt = 1) > usercurve <- survfit(vfit, newdata=userinput) #the entire predicted survival curve > user2 <- summary(usercurve,

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-18 Thread Terry Therneau
Marc gave the referencer for Schoenfeld's article. It's actually quite simple. Sample size for a Cox model has two parts: 1. Easy part: how many deaths to I need d = (za + zb)^2 / [var(x) * coef^2] za = cutoff for your alpah, usually 1.96 (.05 two-sided) zb = cutoff for pow

[R] R code for to check outliers

2012-07-18 Thread Sajeeka Nanayakkara
 What is the R code to check whether data series have outliers or not? Thanks, Sajeeka Nanayakkara [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] read mignight as 24:00 and not as 0:00

2012-07-18 Thread Sandy Adriaenssens
Ok, thank you Dan! I was already afraid that I would get this answer. I will solve it by defining date/time both as a date/time object and as a character object ( in another column) Regards, Sandy -- View this message in context: http://r.789695.n4.nabble.com/read-mignight-as-24-00-and-not-as-

[R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Yolande Tra
Hello, I have the following loop for two data sets: diveData_2008 and diveData_2009. It uses two other data: diveCond_all and fishTable. The problem is at the point to identify the dive_id for the given index (index is timestamp). It keeps on saying for the1st loop Error in fishReport$dive_id[i] <

[R] fitting several lme sistematically

2012-07-18 Thread Berta Ibáñez
Dear R-list, I have a data set (in the following example called "a") which have: one "subject indicator" variable (called "id") three dependent variables (varD, varE, var F) three independent variables (varA, varB, varC) I want to fit 9 lme models, one per posible combination (DA, DB, DC, E

[R] Plotting trajectories of ordinal variables over time by cheating

2012-07-18 Thread Eiko Fried
Hello. I have an ordered dependent variable (scale 0 - 3), 5 measurement points. I am afraid I have strong ceiling effects in my data, and would like to plot the data (trajectories). However, you know that plotting ordered variables isn't really feasible. My question: would you think it appropri

Re: [R] Skip file

2012-07-18 Thread Duncan Murdoch
On 18/07/2012 8:27 AM, bunnylove...@optonline.net wrote: What i have is a for loop to name files. I want it to skip over the file if it doesn't exist. Is there a way to do that? s=seq(from = chron("03/15/2012"), to = chron("06/15/2012")) day=format(as.Date(s), "%Y%m%d") for (k in 1:length(day))

Re: [R] R code for to check outliers

2012-07-18 Thread Bert Gunter
checkforoutliers <- function(series)NULL Cheers, Bert *Explanation: There is no such thing as a statistical outlier -- or, rather,"outlier" is a fraudulent statistical concept, defined arbitrarily and without scientific legitimacy. The typical unstated purpose of such identification is to remove

Re: [R] check whether connection can be opened

2012-07-18 Thread Michael Weylandt
I think you'll need to roll your own using tryCatch() around open(). Michael On Jul 18, 2012, at 5:09 AM, Berry Boessenkool wrote: > > > Hi all, > > I'm working on a function that reads online data that is only available to > certain IPs. It then writes a subset of the data into a file. >

Re: [R] functions of vectors : loop or vectorization

2012-07-18 Thread Uwe Ligges
On 14.07.2012 00:41, Julien Salanie wrote: I have a read a lot about the benefits of vectorization in R. I have a program that takes "almost forever" to run. A good way to see if I have learned something ... My problem can be summarized like this : I have a nonlinear function of several variables

Re: [R] Installing packages from RProfile.site file

2012-07-18 Thread Uwe Ligges
On 17.07.2012 21:34, abhisarihan wrote: I am trying to install custom packages upon starting R. A lot of the code that is written by us right now is available for editing to the users. To try and protect the code, I am packaging the production level code and having the users install it on their

Re: [R] Installing packages from RProfile.site file

2012-07-18 Thread G See
abhisarihan, Please don't crosspost! http://stackoverflow.com/questions/11530800/installing-packages-from-rprofile-site-file Thanks, Garrett On Tue, Jul 17, 2012 at 2:34 PM, abhisarihan wrote: > I am trying to install custom packages upon starting R. A lot of the code > that is written by us ri

[R] keep parameter in step function

2012-07-18 Thread Mati Bielawski
I would like to know how to use the keep parameter in the step function. Or the way to always keep one of my Xs, and the other Xs to be keep or not by step forward method. Thank you all Mati Bielawski [[alternative HTML version deleted]] __ R-he

Re: [R] keep parameter in step function

2012-07-18 Thread Uwe Ligges
On 18.07.2012 18:03, Mati Bielawski wrote: I would like to know how to use the keep parameter in the step function. Or the way to always keep one of my Xs, and the other Xs to be keep or not by step forward method. See ?step and in particular the "lower" part of its scope argument: step(

Re: [R] R code for to check outliers

2012-07-18 Thread R. Michael Weylandt
To further what Bert says: You would almost certainly prefer to use robust statistics than "outlier detection". I believe Greg Snow's TeachingDemos package has a data set "outliers" suggesting some of the perils of doing things the outlier-removal way. Best, Michael On Wed, Jul 18, 2012 at 9:14

Re: [R] R code for to check outliers

2012-07-18 Thread S Ellison
> >> What is the R code to check whether data series have >>> outliers or not? In case noone else has pointed you there, you could try the 'outliers' package. That contains some of the 'standard' methods of outlier testing for univariate data. What you do with them when you find them is a

Re: [R] R code for to check outliers

2012-07-18 Thread Duncan Murdoch
On 18/07/2012 10:14 AM, Bert Gunter wrote: checkforoutliers <- function(series)NULL Cheers, Bert *Explanation: There is no such thing as a statistical outlier -- or, rather,"outlier" is a fraudulent statistical concept, defined arbitrarily and without scientific legitimacy. The typical unstated

Re: [R] R code for to check outliers

2012-07-18 Thread Martin Maechler
> Bert Gunter > on Wed, 18 Jul 2012 07:14:31 -0700 writes: > checkforoutliers <- function(series) NULL > Cheers, Bert > *Explanation: There is no such thing as a statistical > outlier -- or, rather,"outlier" is a fraudulent > statistical concept, defined arbitrari

Re: [R] fitting several lme sistematically

2012-07-18 Thread Jean V Adams
I'm not sure why, but lme() doesn't seem to like the variables to be referenced as part of a list using [ or $. Here's an easy workaround ... ids <- a$id for(i in 2:4){ for(j in 5:7){ y <- a[, j] x <- a[, i] lme(y ~ x , random= ~1|ids, na.action="na.exclude") }} J

Re: [R] weighted mean by week

2012-07-18 Thread Dimitri Liakhovitski
David, thanks a lot! I tried x[-1] myself but forgot to delete 'group' from the keyby statement - this explains why it did not work for me. This is amazing - just 2 lines instead of my many-many. Great learning! Dimitri On Tue, Jul 17, 2012 at 10:49 PM, David Freedman wrote: > Honestly, I wasn't

Re: [R] tweaking forest plot (metafor package)

2012-07-18 Thread Michael Dewey
At 00:10 18/07/2012, eeste...@ualg.pt wrote: Dear All, I'm having trouble tweaking a forest plot made using the R meta-analysis package metafor. I did the analysis based upon the correlation coeff from studies and plotted the corresponding forest plot easily q2<-rma(yi,vi,mods=cbind(grupo),dat

Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Jean V Adams
What is the function index() that you use in this line of code? thisIndex <- as.character(index(diveData_2008[i,])) Is it from some package? Or a function you wrote yourself? I'm trying to run the code you submitted, but I don't have a function called index(). Jean Yolande Tra wrote on 07/18

Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Yolande Tra
it is a function from library(xts) On Wed, Jul 18, 2012 at 1:15 PM, Jean V Adams wrote: > What is the function index() that you use in this line of code? > thisIndex <- as.character(index(diveData_2008[i,])) > > Is it from some package? Or a function you wrote yourself? > I'm trying to run the

Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Rui Barradas
Hello, Try the following. for(i in 1:dim(diveData_2008)[1]){ # Which dive is this observation from thisIndex <- as.character(index(diveData_2008[i,])) thisIndex <- as.POSIXct(thisIndex) dive_id <- diveCond_all$dive_id[diveCond_all$timestamp == thisIndex] #

Re: [R] R code for to check outliers

2012-07-18 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Sajeeka Nanayakkara > Sent: Wednesday, July 18, 2012 6:28 AM > To: r-help@r-project.org > Subject: [R] R code for to check outliers > > > > > >  What is the R code to check w

[R] plotting points to a map

2012-07-18 Thread Gary Dong
Dear R users, I have a city map in shape file (polygon). I also have some points that I hope to plot them to the city map. The only information I have about those points are their relative longitude and latitude to the city center by miles. Is there a way that R can help me to do this? Thanks. Ga

Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Yolande Tra
Thank you Rui. Very helpful. Yolande. On Wed, Jul 18, 2012 at 1:37 PM, Rui Barradas wrote: > Hello, > > Try the following. > > > for(i in 1:dim(diveData_2008)[1]){ > # Which dive is this observation from > thisIndex <- as.character(index(diveData_**2008[i,])) > thisIndex <- as.PO

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-18 Thread Paul Miller
Hi Terry, Greg, and Marc,   Thanks for your advice about this. I think I have a pretty good starting point now for the analysis.   Appreciate your help.   Paul --- On Wed, 7/18/12, Terry Therneau wrote: From: Terry Therneau Subject: Re: [R] Power analysis for Cox regression with a time-varyin

[R] How does "rlm" in R decide its "w" weights for each IRLS iteration?

2012-07-18 Thread Michael
Hi all, I am also confused about the manual: a. The input arguments: wt.method are the weights case weights (giving the relative importance of case, so a weight of 2 means there are two of these) or the inverse of the variances, so a weight of two means this error is half as variable

Re: [R] Imposing more than one condition to if

2012-07-18 Thread Rui Barradas
Hello, You're right. I had thought of this, and I believe there's a day when it happens to have a zero in the middle of the day. R doesn't allow conditions like the one you've written but it does allow multiple conditions, combined using the logical connectives, 'not' - '!', 'or' - '|' and 'a

Re: [R] plotting points to a map

2012-07-18 Thread Sarah Goslee
Hi, On Wed, Jul 18, 2012 at 2:11 PM, Gary Dong wrote: > Dear R users, > > I have a city map in shape file (polygon). I also have some points that I > hope to plot them to the city map. What projection is the shape file in? Have you successfully imported it into R yet? This page has a nice overv

Re: [R] plotting points to a map

2012-07-18 Thread Gary Dong
Thanks, Sara. For your first question: Geographic Coordinate System: GCS_North_American_1983_HARN Projected Coordinate System: NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601_Feet_Intl I have imported the shp file in R by read.shaplefiles(). For your second question: 1) by relative long and la

Re: [R] R code for to check outliers

2012-07-18 Thread Rui Barradas
Hello, Inline Em 18-07-2012 18:44, Nordlund, Dan (DSHS/RDA) escreveu: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Sajeeka Nanayakkara Sent: Wednesday, July 18, 2012 6:28 AM To: r-help@r-project.org Subject: [R] R code for to

Re: [R] Trapping option settings

2012-07-18 Thread David A Vavra
Jim, Thanks. It wasn't sure if merely overriding the options function by placing one in the global environment would guarantee it would be the one actually called. In any case, I didn't know how to identify the caller. This is quite helpful and looks promising. I'll give it a try. DAV -

Re: [R] Trapping option settings

2012-07-18 Thread William Dunlap
Try using trace(), as in trace(options, quote(print(as.list(sys.calls() Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of David A Vavra > Sent: Wednesday, July 18, 20

Re: [R] Mean of matched data

2012-07-18 Thread Peter Ehlers
On 2012-07-18 04:27, Rui Barradas wrote: Helo, All problems should be easy. d <- read.table(text=" gene variable value gender line rep 1 CG1 X208.F1.30456 4.758010 Female 208 1 2 CG1 X365.F2.30478 4.915395 Female 365 2 3 CG1 X799.F2.30509 4.641636 Female 799 2 4 CG1 X306.M2.326

Re: [R] alternate tick labels and tick marks with lattice xyplot

2012-07-18 Thread John Kane
Oh, I clearly misunderstood what you were doing there. I don't know anything about Manhattan plots but a quick google for "manhattan plot r package" turns up a number of items so the type of plot you want may already exist. Sorry to not be of more help. John Kane Kingston ON Canada > -

[R] information

2012-07-18 Thread Karan Anand
hi, i am new to using R, so if u can help me in merging my csv file having different sheets .if u can help me with the commands for it. regards karan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.e

[R] double for cycle

2012-07-18 Thread cesare orsini
Hi nice people, i am trying to made a double "for" cycle, i wish that for cycle on k activates t times the for cycle on s the first cycle is this: s<-rep(1,10) s [1] 1 1 1 1 1 1 1 1 1 1 > for (n in 2:10) { + s[n]=1+s[n]+rnorm(1,mean=0,sd=1) + } > s [1] 1 4.75 4.86 4.05 4.09 4.56 4.63 4.65 4

[R] conditional increase by increment

2012-07-18 Thread penguins
I am trying to assign increasing trip numbers to a binary variable ("land"; 1=home and 0=away) where a string of 1's shouldn't increment the trip_no more than once. For example; based on land<-c(0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0) the "trip_no" sequence produced should be 1,1,1,1,2,2,2,2,2,2,3,3,

Re: [R] Help with correlation matrices, thresholding

2012-07-18 Thread Drinniol
Thank you! I had to make some modifications since my data is between a data set and a subset not one data set to itself, but I was able to use essentially your method to get it working. I did have some trouble with the matrix command on the last line - it kept returning lots of NAs. So I just

[R] Subsetting problem data

2012-07-18 Thread Lib Gray
Hello, I need to subset my data to only look at the parts that have "holes" in it. I already have a formula to get rid of inconsistencies, but now I need to look only at the problem data to reconfigure it. In my data set where there are multiple "cycles" per "patient," and I want to highlight the p

[R] convert deldir$delsgs to a X3D IndexedTriangleSet

2012-07-18 Thread Erdal Karaca
Anyone knows how to convert a deldir$delsgs to a X3D IndexedTriangleSet? Are there already any functions/packages? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do r

[R] The best solver for non-smooth functions?

2012-07-18 Thread Cren
# Hi all, # consider the following code (please, run it: # it's fully working and requires just few minutes # to finish): require(CreditMetrics) require(clusterGeneration) install.packages("Rdonlp2", repos= c("http://R-Forge.R-project.org";, getOption("repos"))) install.packages("Rsolnp2", repos=

Re: [R] alternate tick labels and tick marks with lattice xyplot

2012-07-18 Thread Leah Marian
Yes, I would be interested in both the ggplot2 and lattice ways of doing this. Unfortunately, I am not interested in creating a panel for each chromosome. Actually, I would like to create a Manhattan plot using xyplot. Thus I would need to alternate tick marks and tick labels. Thanks! On Mon,

Re: [R] The best solver for non-smooth functions?

2012-07-18 Thread Cren
# Whoops! I have just seen there's a little mistake # in the 'sharpe' function, because I had to use # 'w' array instead of 'ead' in the cm.CVaR function! # This does not change the main features of my, # but you should be aware of it --- # The function to be minimized sharpe <- function(w) {

Re: [R] Mean of matched data

2012-07-18 Thread robgriffin247
Thanks, in a way this has worked... with a slight modification to this: narrow3<-aggregate(narrow2$value~narrow2$gene+narrow2$gender,data=narrow2,mean) narrow4<-aggregate(narrow2$value~narrow2$gene+narrow2$gender,data=narrow2,sd) which gives a table of the 24000 gene&gender means (narro

Re: [R] NTH PERCENTILE COULMNWIESE

2012-07-18 Thread arun
Hi Try this: mydat <-read.table(text=" ABC    XYZ 12  6 6    50 90    100 55  85 100    25 ",sep="",header=TRUE) apply(mydat,2,quantile,probs=0.2)  ABC  XYZ 10.8 21.2 A.K. - Original Message - From: Rantony To: r-help@r-project.org Cc: Sent: Wednesda

Re: [R] duplicate data between two data frames according to row names

2012-07-18 Thread arun
Hi, You could use "merge", "join" etc. merge(DF3,DF2)  # station lat lon data #1   ST002  41   2    3 #2   ST003  42   3    7 library(plyr)  join(DF3,DF2,type="inner") Joining by: station #  station lat lon data #1   ST002  41   2    3 #2   ST003  42   3    7 #or join(DF3,DF2,type="right") Ho

[R] System Invocation Error - Cspade

2012-07-18 Thread sdoberman
I am trying to run the cspade function in the arulesSequences package in R. After I successfully read in my transactions using read_baskets, I try to execute the cspade function against the transactions object I read in. However, when I execute the command, I obtain an error: system invocation fa

Re: [R] Mean of matched data

2012-07-18 Thread robgriffin247
got it... another merge did the trick narrow6<-merge(narrow2,narrow5,by=c("gene","gender")) Thanks for the help Rui -- View this message in context: http://r.789695.n4.nabble.com/Mean-of-matched-data-tp4636856p4636877.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Variable labels

2012-07-18 Thread Francois Maurice
Thanks a lot, it works fine with me !! François Maurice De : "Nutter, Benjamin" À : Francois Maurice ; r-help@r-project.org Envoyé le : mercredi 18 juillet 2012 8h21 Objet : RE: [R] Variable labels I have my own function for doing this that is similar to the one presented below.  Others may

Re: [R] taylor expansions with real vectors

2012-07-18 Thread bilelsan
Dear list, I have a big deal concerning the development of a Taylor expansion. require(Matrix) e1 <- as.vector(1:5) e2 <- as.vector(6:10) in order to obtain all the combinations between these two vectors following a Taylor expansion (or more simply through a Maclaurin series) for real numbe

Re: [R] R code for to check outliers

2012-07-18 Thread arun
HI, Check this link: http://stackoverflow.com/questions/1444306/how-to-use-outlier-tests-in-r-code Hope it would be helpful. A.K. - Original Message - From: Sajeeka Nanayakkara To: "r-help@r-project.org" Cc: Sent: Wednesday, July 18, 2012 9:27 AM Subject: [R] R code for to check out

Re: [R] Imposing more than one condition to if

2012-07-18 Thread Santiago Guallar
Nice! It works. Thank you, Rui   There's something that takes me back to the original question, though. The code takes the first value that meets the critical condition (light ==0); however, this value can appear more than once a day because these animals nest in dark caves, and once they are in

Re: [R] plotting points to a map

2012-07-18 Thread Barry Rowlingson
On Wed, Jul 18, 2012 at 7:41 PM, Gary Dong wrote: > For your second question: > 1) by relative long and lat, I mean distances to the city center from > south-north and east-west directions. > 2) I know the coordinate of the reference point. The problem here is that going 10 miles north along a

Re: [R] fitting several lme sistematically

2012-07-18 Thread arun
Hi Jean,  Is there something missing in the function? ids <- a$id for(i in 2:4){ for(j in 5:7){     y <- a[, j]     x <- a[, i]     model<-lme(y ~ x , random= ~1|ids, na.action="na.exclude")     }}  summary(model) Linear mixed-effects model fit by REML  Data: NULL    AIC   

[R] Entering Data Files

2012-07-18 Thread darnold
Hi, Entering data from a given file is the hardest part of learning R for me. For example, I have this datafile from Moore's text: LiveAge Count Parents Age19 324 Another Age19 37 OwnPlaceAge19 116 Group Age19 58 Other Age19 5 Parents Age20 378 Another Age20 47 O

Re: [R] Trapping option settings

2012-07-18 Thread David A Vavra
Thanks. Also helpful. DAV -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Wednesday, July 18, 2012 4:20 PM To: David A Vavra; 'jim holtman' Cc: r-help@r-project.org Subject: RE: [R] Trapping option settings Try using trace(), as in trace(options, quote(print

Re: [R] conditional increase by increment

2012-07-18 Thread William Dunlap
> land<-c(0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0) > expect <- c(1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3) > cumsum(c(TRUE, diff(land)==1)) [1] 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 > all.equal(.Last.value, expect) [1] TRUE Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-

Re: [R] fitting several lme sistematically

2012-07-18 Thread Jean V Adams
You have only saved the last run of the for() loop (when i is 4 and j is 7) to the object called model. If you want to save all of the lme fits, you need to set give some dimensionality to the object model. For example, you could define model as a list, then store the lme fits as separate ele

  1   2   >