Re: [R] How to create a new data.frame based on calculation of subsets of an existing data.frame

2019-12-18 Thread Jim Lemon
Hi Ioanna, I looked at the problem this morning and tried to work out what you wanted. With a problem like this, it is often easy when you have someone point to the data and say "I want this added to that and this multiplied by that". I have probably made the wrong guesses, but I hope that you can

Re: [R] issue with numeric

2019-12-18 Thread Brian Kreeger
*snip* Error in cor(D[, 18 + exon_offset], D[, 19 + exon_offset]) : 'x' must be numeric *snip* You are applying the correlation function to non-numeric variables. Brian On Wed, Dec 18, 2019 at 12:23 PM Ana Marija wrote: > Hello, > > I was running this code, located at: > https://github.com/s

[R] choose randomly

2019-12-18 Thread Medic
Bert, I am very grateful for your clear explanation!!! Bert Gunter If n = N, then this is unnecessarily complicated. sample(mydata$Temperature) is all you need (see ?sample). If n < N, then the "trick" is not done. sample(mydata$Temperature, n) is what is wanted. Bert Thank you, Ji

Re: [R] choose randomly

2019-12-18 Thread Bert Gunter
If n = N, then this is unnecessarily complicated. sample(mydata$Temperature) is all you need (see ?sample). If n < N, then the "trick" is not done. sample(mydata$Temperature, n) is what is wanted. Bert On Wed, Dec 18, 2019 at 12:54 PM Jim Lemon wrote: > Hi Medic, > mydata$Temperature[sam

Re: [R] issue with numeric

2019-12-18 Thread Ana Marija
Hello, the error was in the code: D = read.table(opt_input, head = FALSE, stringsAsFactors = FALSE) I should have there header=TRUE Sorry for bothering with this, Ana On Wed, Dec 18, 2019 at 2:44 PM Ana Marija wrote: > > Hi Ivan, > > here it is: > > > str(a) > 'data.frame':17389 obs. of

Re: [R] choose randomly

2019-12-18 Thread Jim Lemon
Hi Medic, mydata$Temperature[sample(1:N,N) should do the trick. You will just get a pseudo-randomly shuffled set of the same values. Jim On Thu, Dec 19, 2019 at 7:34 AM Medic wrote: > > Variable temperature: > mydata$temperature > has N values. > With what code to сhoice (without return) n value

Re: [R] issue with numeric

2019-12-18 Thread Ana Marija
Hi Ivan, here it is: > str(a) 'data.frame':17389 obs. of 21 variables: $ V1 : Factor w/ 17389 levels "ENSG419",..: 14093 14622 14705 14651 14784 17138 14773 14163 14569 15156 ... $ V2 : Factor w/ 22 levels "chr1","chr10",..: 1 1 1 1 1 1 1 1 1 1 ... $ V3

[R] choose randomly

2019-12-18 Thread Medic
Variable temperature: mydata$temperature has N values. With what code to сhoice (without return) n values from them RANDOMLY? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] issue with numeric

2019-12-18 Thread Ivan Krylov
On Wed, 18 Dec 2019 12:25:24 -0600 Ana Marija wrote: > Error in cor(D[, 18 + exon_offset], D[, 19 + exon_offset]) : > 'x' must be numeric Try str(a) to find out the types of the columns. A stray typo could make a representation of a number impossible to parse and make the whole column textual.

Re: [R] issue with numeric

2019-12-18 Thread Rui Barradas
Hello, It's hard to tell without data but: 1) The data is read in in code line 19. Check if it has 19 columns and if columns 18 and 19 are numeric. If they are of class factor run D[18:19] <- lapply(D[18:19], function(x) as.numeric(as.character(x))) 2) code line nr 20 is exon_offset = ifel

Re: [R] how to change format of dates in a tibble

2019-12-18 Thread Duncan Murdoch
On 18/12/2019 11:45 a.m., Christopher W Ryan wrote: I'm not understanding how the tidyverse handles date formats. output of sessionInfo() at the end of my message. dateRanges <- structure(list(apptType = structure(1:2, .Label = c("initial visit", "start of treatment visit"), class = "factor"),

Re: [R] how to change format of dates in a tibble

2019-12-18 Thread Rui Barradas
Hello, You are passing a tbl_df to functions that expect a vector. Here is a first, simpler example. library(tidyverse) df1 <- tibble(Date = Sys.Date() + 0:9) ## both produce expected result format(df1$Date, format = "%d %b %Y") df1 %>% mutate(d = format(Date, format = "%d %b %Y")) Now y

[R] issue with numeric

2019-12-18 Thread Ana Marija
Hello, I was running this code, located at: https://github.com/swvanderlaan/QTLToolKit/blob/master/SCRIPTS/runFDR_cis.R Rscript runFDR_cis.R Retina_new_perms_full.txt 0.05 permutations_all and I got this error: Processing QTLtools output. * Input = [ Retina_new_perms_full.txt ] * FDR=

[R] how to change format of dates in a tibble

2019-12-18 Thread Christopher W Ryan
I'm not understanding how the tidyverse handles date formats. output of sessionInfo() at the end of my message. dateRanges <- structure(list(apptType = structure(1:2, .Label = c("initial visit", "start of treatment visit"), class = "factor"), minMadeRequestDates = structure(c(18124, 18115), class

[R] 2020 Chambers Statistical Software Award submission deadline extended to December 31, 2019

2019-12-18 Thread Yan, Jun
Dear R-help listers, The deadline for the 2020 Chambers Statistical Software Award submission has been extended to December 31, 2019. The Statistical Computing Section of the American Statistical Association announces the competition for the John M. Chambers Statistical Software Award. In 1998