我是一名新程序员。这是我的代码:
library(ggplot2)
library(car)
library(pastecs)
library(psych)
#loading in the data
setwd("D:\\Meus Documentos\\Spider2099\\IC\\Analise de dados-Glandula\\Scripts R\\Histogram")
hist<-read.delim("adultos.txt", header=T)
#setting up the histogram
NormDist<- ggplot(hist,aes(Adultos_1))+ theme(legend.position = "none")+ geom_histogram(aes(y=..density..), colour = "black", fill = "white")
labs(x= "Log2(ratio H/L) Tecnical replicate 1", y= "Density")
#fitting a normal curve
NormDist+stat_function(fun=dnorm, args=list(mean=mean(hist$Adultos_1,na.rm=T),sd=sd(hist$Adultos_1,na.rm=T)),colour = "black", size=1)
*****Warning message:
In mean.default(hist$Adultos_1, na.rm = T) :
argument is not numeric or logical: returning NA*****
我该如何解决这个问题?
答案 0 :(得分:0)
尝试平均值(as.numeric(hist $ Adultos_1),na.rm = T)?
或者我建议不要将其称为&#39; hist&#39;但是hist1。