[R] Setting hetmap.2 Color Key Range Outside of Data Limits

2014-01-16 Thread Dario Strbenac
Hello, There are many questions about making the limit of the colour key smaller than the data range, but I have the opposite problem. Assume one heatmap has data in the range 6 to 12 and another has data in the range 6 to 9. By providing the same breaks argument to both plots, the heatmaps ar

Re: [R] tables package and alternative to col percent

2014-01-16 Thread Daniel Cher
Thanks for the reply. Another great option would be "missing" (like in SAS), especially for factors. I'm struggling to figure out how to do this with "tables". Daniel Cher, MD djc...@gmail.com +1-650-269-5763 This message and its attachments are confidential. -Original Message- From: Du

Re: [R] Doubt in simple merge

2014-01-16 Thread kingsly
Thank you dear friends.  You have cleared my first doubt.   My second doubt: I have the same data sets "Elder" and "Younger". Elder <- data.frame(   ID=c("ID1","ID2","ID3"),   age=c(38,35,31)) Younger <- data.frame(   ID=c("ID4","ID5","ID3"),   age=c(29,21,"NA"))  Row ID3 comes in both

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-16 Thread Vito Ricci
Hi Goran, thanks for your suggestion, but I believe it's not helpful for me... phreg statement "Proportional hazards model with parametric baseline hazard(s). Allows for stratification with dif-ferent scale and shape in each stratum, and left truncated and right censored data" I've data whose

[R] Any recommendations for reusable profiling of name fields?

2014-01-16 Thread Jeff Johnson
Hi, I'm pretty new to R and am trying to develop a reusable set of scripts that I can use to profile various data types and common fields in our database. I know that what I'm asking is a can of worms, so please bear with me. :) For example, we store a person's first name, last name, phone number,

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Martin Weiser
Jim Lemon píše v Pá 17. 01. 2014 v 13:21 +1100: > On 01/17/2014 10:59 AM, Marc Schwartz wrote: > > > > ... > > Arggh. > > > > No, this is my error for not actually looking at the plot and presuming > > that it would work. > > > > Turns out that it does work for a non-stacked barplot: > > > >ba

[R] Predicting probabilities from a logistic regression by hand (in code)

2014-01-16 Thread erikpukinskis
Thanks for looking at this, I've been tearing my hair out for a day or so now. I have done a multiple variable logistic regression in R, and obtained my coefficients. I am able to make predictions for the training data in R without problem. But now I would like to create a prediction model in Ruby

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Jim Lemon
On 01/17/2014 10:59 AM, Marc Schwartz wrote: ... Arggh. No, this is my error for not actually looking at the plot and presuming that it would work. Turns out that it does work for a non-stacked barplot: barplot(VADeaths, angle = 1:20 * 10, density = 10, beside = TRUE) However, internally

Re: [R] xts error: number of items to replace is not a multiple of replacement length

2014-01-16 Thread ce
Indeed it works ! Thanks a lot. But why? -Original Message- From: "arun" [smartpink...@yahoo.com] Date: 01/16/2014 08:44 PM To: "r-help@r-project.org" Subject: Re: [R] xts error: number of items to replace is not a multiple of replacement length Hi, Try: sample.xts["2007-01-02::20

Re: [R] xts error: number of items to replace is not a multiple of replacement length

2014-01-16 Thread arun
Hi, Try: sample.xts["2007-01-02::2007-01-04","Close"] <-sample.xts["2007-01-02::2007-01-04","Close"] +1 sample.xts["2007-01-02::2007-01-04"] #   Open High  Low    Close #2007-01-02 50.03978 50.11778 49.95041 52.11778 #2007-01-03 50.23050 50.42188 50.23050 52.39767 #2007-01-0

[R] xts error: number of items to replace is not a multiple of replacement length

2014-01-16 Thread ce
Dear all , I am getting this error while trying to change columns of an xts object with a date range as index. > library(xts) Loading required package: zoo Attaching package: ‘zoo’ The following object is masked from ‘package:base’: as.Date, as.Date.numeric > data(sample_matrix)

Re: [R] Model averaging using QAICc

2014-01-16 Thread Kamil Bartoń
On 2014-01-15 11:00, r-help-requ...@r-project.org wrote: Date: Wed, 15 Jan 2014 16:39:17 +1000 From: Diana Virkki To:r-help@r-project.org Subject: [R] Model averaging using QAICc Message-ID: Content-Type: text/plain Hi all, I am having some trouble running GLMM's and using model averagin

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Marc Schwartz
On Jan 16, 2014, at 5:03 PM, Martin Weiser wrote: > Marc Schwartz píše v Čt 16. 01. 2014 v 16:46 -0600: >> On Jan 16, 2014, at 12:45 PM, Martin Weiser wrote: >> >>> Dear listers, >>> >>> I would like to make stacked barplot, and to be able to define shading >>> (density or angle) segment-wise

Re: [R] grepping with a variable trouble

2014-01-16 Thread arun
Hi, It's not clear about the pattern in your rownames. In the for() loop, I guess you need rownames(df) instead of df. Using an example dataset (Here the rownames may be different) set.seed(59)  x <- as.data.frame(matrix(rnorm(110),ncol=2)) set.seed(24) row.names(x) <- paste0(row.names(x),Reduce(

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Martin Weiser
Marc Schwartz píše v Čt 16. 01. 2014 v 16:46 -0600: > On Jan 16, 2014, at 12:45 PM, Martin Weiser wrote: > > > Dear listers, > > > > I would like to make stacked barplot, and to be able to define shading > > (density or angle) segment-wise, i.e. NOT like here: > > # Bar shading example > > b

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-16 Thread Göran Broström
On 01/16/2014 04:59 PM, Vito Ricci wrote: Hi guys, is there in some R package a statement to fit parameters in a 3 parameters lognormal distribution. Yes, the function 'phreg' in the package 'eha'. Göran Broström Many thanks Vito Ricci [[alternative HTML version deleted]] ___

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Marc Schwartz
On Jan 16, 2014, at 12:45 PM, Martin Weiser wrote: > Dear listers, > > I would like to make stacked barplot, and to be able to define shading > (density or angle) segment-wise, i.e. NOT like here: > # Bar shading example > barplot(VADeaths, angle = 15+10*1:5, density = 20, col = "black", >

Re: [R] Object not Found Error on a .csv file

2014-01-16 Thread Sarah Goslee
Hi Valerie, Assuming GfullUA is a column of your data frame task2analyses, you need to tell R where to look. It's trying to find an object called GfullUA, and there isn't one. Here are two ways: with(task2analyses, cor(GfullUA, GFullUA)) cor(task2analyses$GfullUA, task2analyses$GFullUA) You mig

[R] Question on adding a p-value in bwplot

2014-01-16 Thread Hae-Young Kim
Hi, I am using "bwplot" to depict the box plots for two group by 6 time points. I need to add 6 p-values in each time point to compare two group at each time point. P-values are (0.0020, 0.0204, 0.3361, 0.0185, 0.1981, and 0.6677). I could depict the two box plots per each time point using the c

[R] Object not Found Error on a .csv file

2014-01-16 Thread Valerie Shalin
Hello: I am a new user, running the latest version of R on my Mac. I have started by reading a file with the read.csv command: task2analyses <- read.csv(file="GroupsWithRTsEqualN.csv",head=TRUE,sep=",") When I print it out in R, the file appears to be intact, with the proper headers. Yet, whe

Re: [R] counts and percentage of multiple categorical columns in R

2014-01-16 Thread arun
Hi Jingxia, May be this helps: dat1 <- read.table(text="fatfreemilk fatmilk halfmilk 2fatmilk A A A A A B B A B A A A C C C C D . A A A E A E C A B A A . A A A B . A A A B E",sep="",header=TRUE,stringsAsFactors=FALSE,check.names=FALSE,na.strings=".")  dat2 <- dat1  dat2$id <- 1:nrow(dat2) librar

Re: [R] counts and percentage of multiple categorical columns in R

2014-01-16 Thread arun
Also, You can do the same with the previous solution: result1 <- result[,-6] vec1 <- unique(unlist(dat1)) result2 <- as.data.frame(t(sapply(dat1,function(x) {counts<- table(factor(x,levels=vec1)); percentage<-sprintf("%.1f",(counts/sum(counts))*100); c(paste0(counts,paste0("(",percentage,")")),

[R] barplot: segment-wise shading

2014-01-16 Thread Martin Weiser
Dear listers, I would like to make stacked barplot, and to be able to define shading (density or angle) segment-wise, i.e. NOT like here: # Bar shading example barplot(VADeaths, angle = 15+10*1:5, density = 20, col = "black", legend = rownames(VADeaths)) The example has 5 diffe

Re: [R] extracting rows from data frame that approximately equal another data frame

2014-01-16 Thread arun
Hi, May be this helps: x <- data.frame(V1=-1.162877, V2=0.1848928)  set.seed(245) df <- as.data.frame(matrix(rnorm(5051*2),ncol=2))  cut1 <- cut(df[,1],breaks=c(x[,1]-0.1,x[,1]+0.1))  cut2 <- cut(df[,2],breaks=c(x[,2]-0.1,x[,2]+0.1)) df1 <- df[!is.na(cut1) & !is.na(cut2),] A.K. I have a data

[R] Regression Modeling Strategies 4-Day Short Course March 2013

2014-01-16 Thread Frank Harrell
My yearly Regression Modeling Strategies course is expanded to 4 days this year to be able relax the pace a bit. Details are below. Questions welcomed. - *RMS Short Course 2014* Frank E. Harrell, Jr., Ph.D., Professor and Chai

Re: [R] names of columns

2014-01-16 Thread arun
I guess, you could also do: names(dat1)[max.col(dat1)] #[1] "a" "b" A.K. On Thursday, January 16, 2014 3:47 PM, arun wrote: Try: dat1 <- read.table(text="a b c d 1  0.5    0.1  0.2   0.2 5  0.3    0.5  0.1   0.1",sep="",header=TRUE)  data.frame(Names=apply(dat1,1,function(x) names(

Re: [R] names of columns

2014-01-16 Thread arun
Try: dat1 <- read.table(text="a b c d 1  0.5    0.1  0.2   0.2 5  0.3    0.5  0.1   0.1",sep="",header=TRUE)  data.frame(Names=apply(dat1,1,function(x) names(x)[x %in% max(x)])) #  Names #1 a #5 b #or colnames(dat1)[apply(dat1,1,which.max)] #[1] "a" "b" A.K. Hi, I need a

Re: [R] Inserting color into an irregular grid comprised of polygons

2014-01-16 Thread Jim Lemon
On 01/17/2014 05:12 AM, Morway, Eric wrote: As a follow up to this thread started nearly a month ago, I'm in need of help sorting out the R code that will create a log-scale legend in the call to "image.plot" below. As the last line of the code provided below shows, I attempted to force the labe

Re: [R] Inserting color into an irregular grid comprised of polygons

2014-01-16 Thread Morway, Eric
As a follow up to this thread started nearly a month ago, I'm in need of help sorting out the R code that will create a log-scale legend in the call to "image.plot" below. As the last line of the code provided below shows, I attempted to force the labeling through the argument "legend.lab", to no

[R] Revolutions blog: December roundup

2014-01-16 Thread David Smith
Happy New Year (if a little late!). Revolution Analytics staff write about R every weekday at the Revolutions blog: http://blog.revolutionanalytics.com and every month I post a summary of articles from the previous month of particular interest to readers of r-help. In case you missed them, here a

[R] Estimating parameters of 3 parameters lognormal distribution

2014-01-16 Thread Vito Ricci
Hi guys, is there in some R package a statement to fit parameters in a 3 parameters lognormal distribution. Many thanks Vito Ricci [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] Doubt in simple merge

2014-01-16 Thread Marc Schwartz
Not quite: > rbind(Elder, Younger) ID age 1 ID1 38 2 ID2 35 3 ID3 31 4 ID4 29 5 ID5 21 6 ID3 31 Note that ID3 is duplicated. Should be: > merge(Elder, Younger, by = c("ID", "age"), all = TRUE) ID age 1 ID1 38 2 ID2 35 3 ID3 31 4 ID4 29 5 ID5 21 He wants to do a join on both

[R] DTM Package removeSparseTerms function question

2014-01-16 Thread ramoss
IN inspect(removeSparseTerms(dtm, 0.4)) does anyone knows how the sparse term "A numeric for the maximal allowed sparsity" works? ie what is the difference between say 0.2, 0.4 & 0.6? Thanks for your help -- View this message in context: http://r.789695.n4.nabble.com/DTM-Package-r

Re: [R] Doubt in simple merge

2014-01-16 Thread Frede Aakmann Tøgersen
Ups, sorry that should have been mer <- rbind(Elder, Younger) /frede Oprindelig meddelelse Fra: Frede Aakmann Tøgersen Dato:16/01/2014 15.54 (GMT+01:00) Til: "Adams, Jean" ,kingsly Cc: R help Emne: Re: [R] Doubt in simple merge No I think the OP wants mer <- merge(Elder, Yo

Re: [R] Doubt in simple merge

2014-01-16 Thread Frede Aakmann Tøgersen
No I think the OP wants mer <- merge(Elder, Younger) Br. Frede Oprindelig meddelelse Fra: "Adams, Jean" Dato:16/01/2014 15.45 (GMT+01:00) Til: kingsly Cc: R help Emne: Re: [R] Doubt in simple merge You are telling it to merge by ID only. But it sounds like you would like it

Re: [R] ifelse...

2014-01-16 Thread Duncan Murdoch
On 16/01/2014 8:46 AM, ONKELINX, Thierry wrote: You want y <- ifelse(x == 'a', 1, 2) or use if, rather than ifelse, i.e. if (x == 'a') { y <- 1 } else { y <- 2 } ifelse() is mainly used when you want to work with whole vectors of decisions, e.g. x <- 1:10 ifelse(x > 5, 1, 0) Duncan M

Re: [R] Doubt in simple merge

2014-01-16 Thread Adams, Jean
You are telling it to merge by ID only. But it sounds like you would like it to merge by both ID and age. merge(Elder, Younger, all=TRUE) Jean On Thu, Jan 16, 2014 at 6:25 AM, kingsly wrote: > Dear R community > > I have a two data set called "Elder" and "Younger". > This is my code for simp

[R] Doubt in simple merge

2014-01-16 Thread kingsly
Dear R community I have a two data set called "Elder" and "Younger". This is my code for simple merge. Elder <- data.frame(   ID=c("ID1","ID2","ID3"),   age=c(38,35,31)) Younger <- data.frame(   ID=c("ID4","ID5","ID3"),   age=c(29,21,31)) mer <- merge(Elder,Younger,by="ID", all=T) Output

Re: [R] ifelse...

2014-01-16 Thread ONKELINX, Thierry
You want y <- ifelse(x == 'a', 1, 2) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 thierry.onk

[R] ifelse...

2014-01-16 Thread Tim Smith
Hi, Sorry for the newbie question! My code: x <- 'a' ifelse(x == 'a',y <- 1, y <- 2) print(y) Shouldn't this assign a value of 1? When I execute this I get: > x <- 'a' > ifelse(x == 'a',y <- 1, y <- 2) [1] 1 > print(y) [1] 2 Am I doing something really daft??? thanks! > sessionInfo() R ve

[R] predefined area under the curve

2014-01-16 Thread eliza botto
Dear UseRs of R, My sincere apologizes in advance if my question isn't relevant to the operations in R. I actually have the following two columns data, with 12 rows in it. > dput(el) structure(c(-1.42607687227285, -1.0200762327862, -0.736315917376129, -0.502402223373355, -0.293381232121193, -0

Re: [R] Subgroups definition with rpart

2014-01-16 Thread Prof Brian Ripley
Search for 'where' in ?rpart.object (linked from ?rpart). On 16/01/2014 08:50, Jérémy Lambert wrote: Hello everyone, I just completed a recursive pratitionning analysis, using rpart, and have a beautiful tree with 6 terminal nodes. Each terminal node containing a precise number of patients (

[R] Subgroups definition with rpart

2014-01-16 Thread Jérémy Lambert
Hello everyone, I just completed a recursive pratitionning analysis, using rpart, and have a beautiful tree with 6 terminal nodes. Each terminal node containing a precise number of patients (it's a clinical study), I'd like to create a new variable informing in which terminal node are locating

Re: [R] Behavior of self-defined function within ddply

2014-01-16 Thread arun
Hi, May be this helps: small <- read.table(text="monthend_n ticker wgtdiff ret interval b1 b2 b3 b4 b5 b6 1 19990228 AA 0.7172 -2.58 0.33896 -0.5868 -0.24784 0.09112 0.43008 0.76904 1.108 2 19990228 AAPL -0.0828 -15.48 0.33896 -0.5868 -0.24784 0.09112 0.43008 0.76904 1.108 3 19990228 ABCW 0.0