Re: [R] Identifying column type

2021-04-09 Thread Rui Barradas
Hello, Maybe something like ok <- sapply(mydata, is.numeric) mydata <- mydata[ok] to keep the numeric columns only. Hope this helps, Rui Barradas Às 04:25 de 10/04/21, Steven Yen escreveu: I have data of mixed types in a data frame - date and numeric, as shown in summary below. How do I

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Bert Gunter
I freely admit that I do not understand what you mean. But it sounds like you are trying to make things more complicated than necessary. Perhaps this little example may help clarify the issues: > a <- 1; b <- 2; d <- c(3,5) > stuff <- lapply(list(a,b,d),function(x)x^2) > stuff [[1]] [1] 1 [[2]]

Re: [R] Identifying column type

2021-04-09 Thread Steven Yen
Thanks much! Yes it does. I will read. On 2021/4/10 上午 11:33, Jeff Newmiller wrote: Does sapply( mydata, inherits, what = "POSIXt" ) give you any ideas? On April 9, 2021 8:25:36 PM PDT, Steven Yen wrote: I have data of mixed types in a data frame - date and numeric, as shown in summary bel

Re: [R] Identifying column type

2021-04-09 Thread Jeff Newmiller
Does sapply( mydata, inherits, what = "POSIXt" ) give you any ideas? On April 9, 2021 8:25:36 PM PDT, Steven Yen wrote: >I have data of mixed types in a data frame - date and numeric, as shown > >in summary below. How do I identify the column(s) that is/are not >numeric, in this case, the firs

[R] Identifying column type

2021-04-09 Thread Steven Yen
I have data of mixed types in a data frame - date and numeric, as shown in summary below. How do I identify the column(s) that is/are not numeric, in this case, the first. All I want is to identify the column(s) and so that I can remove it/them from the data frame Thanks. > summary(mydata) Dat

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
As I wrote before, I calculate tbl_graph objects, which will be joined afterwards. Not too much, the number of graphs to calculate is in the range between 5 to 20. Further steps are not automated, because they depend on how the single graphs look like, and which of them will be joined. For thi

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
David, I don't think that this is the case. When I do the calculation like this subnet_MYSUBNET <- my_function(MYSUBNET), i.e. assigning a variable by hand to each function result, all is fine. Am 9. April 2021 17:22:05 MESZ schrieb David Winsemius : > >On 4/9/21 5:21 AM, Wolfgang Grond wrot

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Folks, first of all - thanks a lot for your hints! I will try each again and think about, why I get error messages. But to resume: if I understand you right: there is no way to do something like this: $name = $result? Regards Wolfgang Am 9. April 2021 15:43:27 MESZ schrieb Rui Barradas : >H

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread David Winsemius
On 4/9/21 5:21 AM, Wolfgang Grond wrote: Greg, here I get the error message: Error my_function(val) : cannot find function my_function. I'm guessing that you are following someone else's blog and have failed one of two things: - understand that what was meant by the author was that you

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Rui Barradas
Hello, my_function seems to be a function you have defined somewhere in your code. In your original post you mention it 3 times, this is the first one: subnet_MYSUBNET <- my_function(MYSUBNET) So Ivan's and Greg's code should work, they use a function you haven't posted but is assumed to exi

Re: [R] Unable to extract gene list from chromosome

2021-04-09 Thread pooja sinha
Hi David, That's the only file I have for analysis and I am also getting the final_1 as 0 obs. of 6 variables. My problem is that I am not getting any output. It seems like I am missing something in the* values* code but I don't know what. Just for your hint I googled and some people have suggest

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Greg, here I get the error message: Error my_function(val) : cannot find function my_function. Am 9. April 2021 12:35:40 MESZ schrieb Greg Minshall : >Wolfgang, > >> result <- assign(paste("subnet_",  val, sep = "") >> >> result <- my_function(val) > >i don't understand why you are twice assig

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Ivan, same situation when I try your list() solution: Error in eval ... : object 'function' not found ( I think anything about my_function is meant). Am 9. April 2021 13:43:57 MESZ schrieb Ivan Krylov : >Dear Wolfgang, > >On Fri, 9 Apr 2021 11:48:55 +0200 >Wolfgang Grond wrote: > >> I want to

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Dear Ivan, when I try your solution with lapply as below I get the following error message: Error in eval ... : object 'function' not found ( I think anything about my_function is meant). Am 9. April 2021 13:43:57 MESZ schrieb Ivan Krylov : >Dear Wolfgang, > >On Fri, 9 Apr 2021 11:48:55 +0200 >

Re: [R] Unable to extract gene list from chromosome

2021-04-09 Thread pooja sinha
Hi David, Sorry I forgot to attach the file. Now it's attached. Thanks, Puja On Thu, Apr 8, 2021 at 6:01 PM David Winsemius wrote: > > On 4/8/21 2:30 PM, pooja sinha wrote: > > Hi All, > > > > I am trying to extract gene list from chromosome number and position, for > > that I am using biomaR

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Ivan Krylov
Dear Wolfgang, On Fri, 9 Apr 2021 11:48:55 +0200 Wolfgang Grond wrote: > I want to assign the subnets to variables whose names contain the > name of the subnet Apologies if this sounds too opinionated, but creating variable names from variable values is a FAQ in a different dynamic language: h

Re: [R] Plotting adjusted KM curve

2021-04-09 Thread Göran Broström
On 2021-04-05 03:34, Sorkin, John wrote: Colleagues, I am using the coxph to model survival time. How do I plot an adjusted Kaplan Meir plot resulting from coxph? The code I would like to run would start with: # run cox model fit1Cox <- coxph(surv_object ~age+sex,data=mydata) I have no idea

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Greg Minshall
Wolfgang, > result <- assign(paste("subnet_",  val, sep = "") > > result <- my_function(val) i don't understand why you are twice assigning to =result=. also, the first assignment doesn't seem well formatted (t's missing a value?). did you mean something like : assign(paste("subnet_",  val, s

Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread PIKAL Petr
Hi I may be wrong but > result <- assign(paste("subnet_", val, sep = "") here you miss the right parentheses maybe you intended assign(result, paste("subnet_", val, sep = "")) > result <- my_function(val) but here you change (rewrite) the result variable to my_function result So your overall

[R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Dear all, I'm creating a list (which is a tbl_graph) by a function, and assign the result to a variable: subnet_MYSUBNET <- my_function(MYSUBNET) # MYSUBNET: a tbl_graph Because there are multiple subnets to create, I can get the names of the subnets (MYSUBNET1, MYSUBNET2, MYSUBNET3, etc.) fr

Re: [R] Plotting adjusted KM curve

2021-04-09 Thread PIKAL Petr
Hi Google answered https://rdrr.io/bioc/survcomp/man/km.coxph.plot.html Is it what do you want? Cheers Petr > -Original Message- > From: R-help On Behalf Of Sorkin, John > Sent: Monday, April 5, 2021 3:35 AM > To: r-help@r-project.org (r-help@r-project.org) > Subject: [R] Plotting ad