[R] xyplot() conventions for multiple conditioning vars lattice pkg

2019-07-19 Thread Doran, Harold
Here is a toy example of what I want library(lattice) result <- data.frame(score = 1:10, theta = seq(from = -5, to = 5, length = 10)) result$theta2 <- result$theta + .3 xyplot(score ~ theta + theta2, result, type = c('g', 'l')) However, in reality, the number of variables along the x-axis will v

[R] How to create a data set from object/data frame?

2019-07-19 Thread Spencer Brackett
Hello, I am trying to create a data set from an object called ‘anno’ in my environment. I’ve tried arguments like saveRDS(anno, file = “”) and save(anno, file “.RData”) to save the object as a file to see if that will work, but it seems for the particular procedure I am trying to carry out, I ne

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Sarah Goslee
Hi Spencer, Your description doesn't make any sense to me. If anno is already an R object, what are you trying to do with it? data() is for loading datasets that come with packages; if your object is already an R object in your environment, then there's no need for it. It sounds like you are pos

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Spencer Brackett
Sarah, I am trying to extract phenoData (ie sample information) from the object as part of a procedure to analyze my array for probe sets, which I realize is under the BioConducter package Biobase and not relevant to this mailing list. Yes the original procedure uses data from the Dilution da

Re: [R] xyplot() conventions for multiple conditioning vars lattice pkg

2019-07-19 Thread Bert Gunter
xyplot(formula(result), result, type = c( 'g','l')) See ?formula (the part about the dataframe method) for details. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Sarah Goslee
Right. If you have some equivalent to the Dilution dataset, then you need to get it into R in the appropriate way for whatever data you have. data() is merely a way to get stored R data into your R session. There's no reason you need to use data() rather than read.table() or whatever is appropriat

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Spencer Brackett
Sarah, Thank you for the reference to ?data. Upon further research into the matter, I think I can provide a simpler explanation than the one previously provided. I am trying to reproduce the following code with an object -- 'anno' -- in my data frame/environment. >fake.data <- matrix(rnorm(8*20

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Sarah Goslee
You don't need fake.data or rnorm(), which was used to generate the fake data. You need to use your real data for the analysis, not anything randomly generated for example purposes, or anything included with a package for example purposes. In both cases, those are just worked examples.You need to

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Spencer Brackett
Okay. I am a little confused as to how to proceed with that. The next part of the procedure as seen below appears to be substituting information from this fake data set into the following arguments in order to sample.info <- data.frame( + spl=paste('A', 1:8, sep=''), + stat=rep(c('cancer' , 'heal

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Spencer Brackett
Sarah, Okay. I am a little confused about how to proceed. How do I substitute my anno object for the Dilution dataset, when in these following lines of the code, as it appears that info from the fake dataset was extracted.. ? sample.info <- data.frame( + spl=paste('A', 1:8, sep=''), + stat=rep(

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Sarah Goslee
Okay, at this point I have three suggestions, because you're clearly not yet understanding the R workflow. 1. Read at least the Intro to R manual. https://cran.r-project.org/doc/manuals/R-intro.pdf 2. Go through your sample code carefully, step by step, using functions like str() and head() to loo

Re: [R] How to create a data set from object/data frame?

2019-07-19 Thread Spencer Brackett
Thank you for the advice On Fri, Jul 19, 2019 at 2:25 PM Sarah Goslee wrote: > Okay, at this point I have three suggestions, because you're clearly > not yet understanding the R workflow. > > 1. Read at least the Intro to R manual. > https://cran.r-project.org/doc/manuals/R-intro.pdf > 2. Go thr

[R] Check to see if a value is included within intervals

2019-07-19 Thread Marine Regis
Hello all, The R code below tests if values of the variable �t� are included or not within intervals that are defined from the data frame dat. The expected results are displayed using the function "rle" (see code below). Here is the code: ta <- 100 tb <- 140 tc <- 40 td <- 85 datF <- data.fram

Re: [R] Check to see if a value is included within intervals

2019-07-19 Thread Bert Gunter
If I understand correctly (make sure that I do!), ?findInterval should essentially do what you want. In your example (thanks!), I assume that: 1) The cutpoints defining your intervals are increasing, so p1 < p2 < p3 (p4 is unused) 2) You want to know which t2's are in the two intervals t2 <= p1 a

Re: [R] Check to see if a value is included within intervals

2019-07-19 Thread Marine Regis
Thank you very much Bert for your answer. I would like reproduce the same results as the code below: ta <- 100 tb <- 140 tc <- 40 td <- 85 datF <- data.frame(t = 1:3650, e = NA) dat <- data.frame(a = seq(1, 3650, 365), b = seq(ta, 3650, 365), c = seq(ta + 1, 3

Re: [R] Check to see if a value is included within intervals

2019-07-19 Thread Jeff Newmiller
There is no reason for you to tell anyone on this list how they should accomplish your goal... we are not a free (or paid) programming service. If you are in fact obligated to use your proposed approach, then you are most likely doing homework and this list is expressly not for homework (re-rea

[R] CoxPH multivariate frailty model with coxph (survival)

2019-07-19 Thread Denise b
Dear R users, I am interested in estimating the effects of a treatment on two time-to-event traits (on simulated data), accounting for the dependency between the two time-to-event outcomes. I precise that the events are NOT recurrent, NOT competitive, NOT ordered. The individuals are NOT related