Re: [R] ancova for dependent response

2016-11-21 Thread Jeff Newmiller
Yes. https://lmgtfy.com/?q=R+ancova -- Sent from my phone. Please excuse my brevity. On November 21, 2016 9:09:58 PM PST, li li wrote: >Hi all, >Is there an R function which can handles dependent response in Analysis >of covariance model. The dependence structure is known and is there to >accoun

Re: [R] using conditionals to select rows in data.table

2016-11-21 Thread Jeff Newmiller
Cut-and-paste is whatever you cut.. cut from a text editor and you will get text. Notepad++ is one such program. Recommendation: set your mail program to text and put your question on the body of the email. Attachments sometimes get through, but they really are not the preferred way to communic

[R] using conditionals to select rows in data.table

2016-11-21 Thread Carl Sutton via R-help
Hopefully the attached is text and not html.  I have not found a text option in firefox. I have also been informed that a windows cut and paste is not truly text, which is the reason for the attachment from notepad++ If there is any way I can improve the question, please inform of the problem

[R] ancova for dependent response

2016-11-21 Thread li li
Hi all, Is there an R function which can handles dependent response in Analysis of covariance model. The dependence structure is known and is there to account for it in ANCOVA analysis in R? Thanks. Hanna [[alternative HTML version deleted]] _

[R] how to use vector of values to change row order of a heatmap

2016-11-21 Thread Fix Ace via R-help
Hello, there, R document for heatmap says that Rowv could be a vector of values to specify the row order. However, I couldn't figure out how to apply it. A simple example here:> b=as.data.frame(matrix(c(3,4,5,8,9,10,13,14,15,27,19,20),3,4)) > b   V1 V2 V3 V4 1  3  8 13 27 2  4  9 14 19 3  5 10 15

[R] gbm question

2016-11-21 Thread David Katz via R-help
R-Help, Please help me understand why these models and predictions are different: library(gbm) set.seed(32321) N <- 1000 X1 <- runif(N) X2 <- 2*runif(N) X3 <- ordered(sample(letters[1:4],N,replace=TRUE),levels=letters[4:1]) X4 <- factor(sample(letters[1:6],N,replace=TRUE))

[R] how to use vector of values to change row order of a heatmap

2016-11-21 Thread Fix Ace via R-help
Hello, there, R document for heatmap says that Rowv could be a vector of values to specify the row order. However, I couldn't figure out how to apply it. A simple example here:> b=as.data.frame(matrix(c(3,4,5,8,9,10,13,14,15,27,19,20),3,4)) > b   V1 V2 V3 V4 1  3  8 13 27 2  4  9 14 19 3  5 10 15

Re: [R] Combining columns

2016-11-21 Thread Olu Ola via R-help
Thank you Jim and Don. On Monday, November 21, 2016 4:54 PM, Jim Lemon wrote: Hi Olu, If you always have only one non-NA value in the first three columns: veg_df<-data.frame(col1=c(NA,"cassava","yam",NA,NA,NA,"maize"), col2=c("pumpkin",NA,NA,"cherry",NA,NA,NA), col3=c(NA,NA,NA,NA,"pe

Re: [R] Combining columns

2016-11-21 Thread MacQueen, Don
Something along the lines of tmpfun <- function(chvec) chvec[!is.na(chvec)] apply( mydata, 1, tmpfun) Assuming every row has only one non-NA entry. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 11/21/16, 1:26 PM, "R-hel

Re: [R] Combining columns

2016-11-21 Thread Jim Lemon
Hi Olu, If you always have only one non-NA value in the first three columns: veg_df<-data.frame(col1=c(NA,"cassava","yam",NA,NA,NA,"maize"), col2=c("pumpkin",NA,NA,"cherry",NA,NA,NA), col3=c(NA,NA,NA,NA,"pepper","mango",NA)) veg_df$col4<-apply(as.matrix(veg_df),1,function(x) x[!is.na(x)]) Jim

Re: [R] Combining columns

2016-11-21 Thread Rui Barradas
Hello, Try the following. dat <- read.table(text = " | colA | colB | colC | colD | | NA | pumpkin | NA | Pumpkin | | Cassava | NA | NA | Cassava | | yam | NA | NA | yam | | NA | Cherry | NA | Cherry | | NA | NA | Pepper | Pepper | | NA | NA | Mango | Mango | | maize | NA | NA | maize | ", header

Re: [R] explicit coercion warnings as.numeric Versus as.logical

2016-11-21 Thread Jim Lemon
Hi Ramnik, Bert's answer is correct, and an easy way to see why is to look at: c(1,F,"b") [1] "1" "FALSE" "b" The reason that "F" is translated to "FALSE" is that is its default value when R is started. If you change that value: F<-"foo" c(1,F,"b") [1] "1" "foo" "b" as.logical(c(1,F,"b"))

[R] Combining columns

2016-11-21 Thread Olu Ola via R-help
Hello,I have the following data | colA | colB | colC | colD | | NA | pumpkin | NA | Pumpkin | | Cassava | NA | NA | Cassava | | yam | NA | NA | yam | | NA | Cherry | NA | Cherry | | NA | NA | Pepper | Pepper | | NA | NA | Mango | Mango | | maize | NA | NA | maize | All I want to do is to combine

Re: [R] Presenting Hazard ratios for interacting variables in a Cox model

2016-11-21 Thread David Winsemius
> On Nov 21, 2016, at 4:21 AM, Stuart Patterson > wrote: > > Dear David, > Thank you for your reply. Your suggestions on how better to write the command > are very useful, and I can see how the simplification would help. I hadn't > realised that the lower order variables would be included if

[R] Question on 'predict' in 'markovchain' package

2016-11-21 Thread Huang, Cassie
Dear Sir/Madam, I want to report a problem of 'predict' function in the 'markovchain' package and I will use to examples to explain the problem. Problem: -It only follows the path with transition probability greater or equal than 0.5. Here are two examples. Example (1) I created an MC with th

Re: [R] Help with R

2016-11-21 Thread MacQueen, Don
To go further with your teacher's code, I would start by finding out what kind of object "map" is, in R terms. For example, can your teacher give you the output from the commands: class(map) str(map) ? Without that information, I don't think anyone here can give you effective help. Also, as o

[R] Using contrast with cox models

2016-11-21 Thread Patterson, Stuart
Hi, I was wondering if I could get some advice on the following question please: I have a time-dependent cox model with three variables, each of which interacts with the other two. So my final model is: fit12<-coxph(formula = Surv(data$TimeIn, data$Timeout, data$Status) ~ data$Year+data$Life_S

Re: [R] explicit coercion warnings as.numeric Versus as.logical

2016-11-21 Thread Bert Gunter
Not an answer, but note that your vectors are all first (silently) coerced to character, as vectors must be all of one type. I would hazard a guess that the answer is: it's simply an arbitrary inconsistency (different folks wrote the functions at different times). Note that AFAICS, the difference

Re: [R] Presenting Hazard ratios for interacting variables in a Cox model

2016-11-21 Thread Stuart Patterson via R-help
Dear David, Thank you for your reply. Your suggestions on how better to write the command are very useful, and I can see how the simplification would help. I hadn't realised that the lower order variables would be included if I simply wrote in teh interaction terms. Thank you The table below is ho

[R] fdaPDE Documentation and examples

2016-11-21 Thread BARLAS Marios 247554
Hello, I'm trying to use R for solving PDEs ( heat and Poisson equations) in R. I found fdaPDE as a package implementing FEMs, has any1 used it before ? I find it severely lacks documentation and examples on its usage. Any feedback is welcome! Thanks in advance, Marios Barlas PhD Candidate

[R] explicit coercion warnings as.numeric Versus as.logical

2016-11-21 Thread Ramnik Bansal
Hi, I am trying to understand under which specific conditions does explicit coercion produce warnings. > as.numeric(c(1, F, "b")) [1] 1 NA NA Warning message: NAs introduced by coercion > as.logical(c(1, F, "b")) [1]NA FALSENA In above examples, as.numeric produces warning but as.logi