Hi,
I have the code for the density plot
j <- 8
plot(density(diff_in_sample[,1]), main = list.files()[j])
for(i in 1:25){
lines(density(diff_in_sample[,i]))
}
This gives me an error
Error in density.default(diff_in_sample[, i]) :
'x' contains missing values
I am not quite sure what to do. I have the same code doing plots for
otherfiles but just one is not working. what xactly it means missing values
even if there is there how can i tell it to overlook those
any help would be appreciated
Thanks
Ramya
--
View this message in context:
http://r.789695.n4.nabble.com/error-in-density-plot-tp3253489p3253489.html
Sent from the R help mailing list archive at Nabble.com.
Ramya <ramya.victory <at> gmail.com> writes:> I have the code for the density plot > j <- 8 > plot(density(diff_in_sample[,1]), main = list.files()[j]) > for(i in 1:25){ > lines(density(diff_in_sample[,i])) > } > > This gives me an error > Error in density.default(diff_in_sample[, i]) : > 'x' contains missing values[snip] ?NA lines(na.omit(density(diff_in_sample[,i]))) Consider replacing the loop by apply() [no efficiency gain, but more compact code]