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 <sokovic.anamar...@gmail.com> wrote: > > Hi Ivan, > > here it is: > > > str(a) > 'data.frame': 17389 obs. of 21 variables: > $ V1 : Factor w/ 17389 levels "ENSG00000000419",..: 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 : int 29571 36082 91106 133724 173863 200323 259025 > 297503 348367 493242 ... > $ V4 : int 29570 36081 91105 133723 173862 200322 259024 > 297502 348366 493241 ... > $ V5 : Factor w/ 2 levels "-","+": 1 1 1 1 1 1 1 1 1 1 ... > $ V6 : int 983 1006 1169 1340 1441 1620 1897 2032 2175 2697 ... > $ V7 : int -828479 -38709 -782443 69986 -831895 -980529 > -647609 -946918 -631093 -886444 ... > $ V8 : Factor w/ 17104 levels "1:10095977:G:GT",..: 7339 > 4761 2344 7480 12580 4781 14856 3061 9397 6938 ... > $ V9 : Factor w/ 22 levels "chr1","chr10",..: 1 1 1 1 1 1 > 1 1 1 1 ... > $ V10 : int 858049 74790 873548 63735 1005757 1180851 > 906633 1244420 979459 1379685 ... > $ V11 : int 858049 74790 873548 63738 1005771 1180851 > 906633 1244420 979459 1379685 ... > $ Effect_allele : Factor w/ 358 levels "A","AAAAACAAAAC",..: 267 190 > 92 92 54 92 190 1 267 267 ... > $ Baseline_allele: Factor w/ 435 levels "A","AAAAAAAAAATAAAAAT",..: > 112 112 325 175 1 325 325 237 112 237 ... > $ V12 : int 404 404 404 404 404 404 404 404 404 404 ... > $ V13 : num 348 347 347 339 342 ... > $ V14 : num 1.04 1.03 1.02 1.04 1.04 ... > $ V15 : num 140 138 153 154 171 ... > $ V16 : num 0.000742 0.002822 0.000626 0.000798 0.002894 ... > $ V17 : num 0.269 -0.687 -0.285 -0.398 0.341 ... > $ V18 : num 0.196 0.531 0.203 0.265 0.639 ... > $ V19 : num 0.198 0.529 0.199 0.261 0.634 ... > > and this: > > > which(is.na(as.numeric(as.character(a[,18])))) > [1] 10757 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 > [13] 11073 11074 11075 > > which(is.na(as.numeric(as.character(a[,19])))) > [1] 10757 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 > [13] 11073 11074 11075 > > columns 18 and 19 seems to be numeric, what is could be the issue? > > On Wed, Dec 18, 2019 at 1:49 PM Ivan Krylov <krylov.r...@gmail.com> wrote: > > > > On Wed, 18 Dec 2019 12:25:24 -0600 > > Ana Marija <sokovic.anamar...@gmail.com> 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. Use > > which(is.na(as.numeric(as.character(a[,column_number])))) to find out > > the row number where it happened (using extra as.character() here in > > case the column is a factor). > > > > -- > > Best regards, > > Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.