Entering edit mode
6.8 years ago
emmachristison
•
0
Does anyone know what is wrong with this? it has worked in the past. Also, how do I ensure that all of the graph fits on the pdf export? It cuts off.
pheatmap(log2(data + 1), cluster_rows=T, cluster_cols=F, show_rownames = T, cellwidth = 7)
Error in Math.data.frame(data + 1) :
non-numeric variable in data frame: c(NA, NA, NA, NA, NA)
In addition: Warning message:
In Ops.factor(left, right) : ‘+’ not meaningful for factors
Thanks Em
I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
Something is wrong with your data variable - it's not what you think it is. Have a look at it using
str(data)
andhead(data)
.Hello,
It's what I expect it to be and have used before - a list of genes and the coinciding gene expression number - should I format the cell in a certain way?
Thanks!
Can you post
str(data)
? The warning says there are unexpected factors. Make sure the data types of your variables and columns are correct.These are the first few lines:
AGAIN: I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
And look at the column with name
X
. That's a factor. You cannot do a factor + 1.The cell on the .csv with the X is blank - how do I resolve the issue?
According to the output of
str()
it's not blank. It at least contains5 levels "AMBRA1","BNIP3"
. You can drop the column fromdata
.To complement this, check how you're reading the data. The read.table() function and it's variants read a column of numbers as strings and convert them to factors if they see anything that doesn't look like numbers (like NA for example). Also since R 3.1, numbers with too many digits are also read as strings and converted to factors. See type.convert().
Hello!
this is how I am currently reading the .csv:
Thanks Emma
AGAIN AGAIN
I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
If you want help - spend some effort making your question easy to read.
Do you mean you're reading it twice ? Or that these are the two different commands that you've tried ?