Hi so I'm trying to do limma fitting on my data but i keep getting the following error
1
0
Entering edit mode
@zbiranvand1983-7126
Last seen 9.0 years ago

Hi so I'm trying to do limma fitting on my data but i keep getting the following error

> library(limma)
> data<-read.table("C:/Users/test/Desktop/book1.txt",header = T, row.names = 1)
> dim(data)
[1] 720  14
> pairs(data)
> pairs(data)# it is better to use log2
> design <- model.matrix(~ 0+factor(c(rep(1,6),rep(2,8))))
> colnames(design) <- c("treat1","control1")
> #fit a linear model
>  fit <- lmFit(data, design)
Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be numeric
limma • 2.4k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 5 hours ago
United States

You would have to show what is in your 'data' object (btw, not a really good name, as you are masking an existing function). But do note that getEAWP(), which is the function that processes your data will do this:

y$exprs <- as.matrix(object)

and if any of the values in your data.frame are factors (the default for read.table() is to convert character like data into factors), then you will end up with a matrix of all characters. To wit:

> z <- data.frame(1:10, 2:11)
> as.matrix(z)
      X1.10 X2.11
 [1,]     1     2
 [2,]     2     3
 [3,]     3     4
 [4,]     4     5
 [5,]     5     6
 [6,]     6     7
 [7,]     7     8
 [8,]     8     9
 [9,]     9    10
[10,]    10    11
> z <- data.frame(letters[1:10], z)
> as.matrix(z)
      letters.1.10. X1.10 X2.11
 [1,] "a"           " 1"  " 2"
 [2,] "b"           " 2"  " 3"
 [3,] "c"           " 3"  " 4"
 [4,] "d"           " 4"  " 5"
 [5,] "e"           " 5"  " 6"
 [6,] "f"           " 6"  " 7"
 [7,] "g"           " 7"  " 8"
 [8,] "h"           " 8"  " 9"
 [9,] "i"           " 9"  "10"
[10,] "j"           "10"  "11"
> z[,1]
 [1] a b c d e f g h i j
Levels: a b c d e f g h i j

 

ADD COMMENT

Login before adding your answer.

Traffic: 1367 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6