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

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] 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

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