Error in hist.default(da1$log.Transp) : 'x' must be numeric

Hello Friends

I am new to R programming and this communty. I am stuck in problem, it may be silly but if somone could guide would be great. I am looking to transfrom and plot a feature but it give me below error:

da1
Inc Transp Car Hhld Care Eng CR Dementia Health C.Rate
1 0.210 6.4 38.6 18.0 5.3 16.5 27.4 5.7 59.1 4.2
2 0.356 6.8 63.8 69.0 3.4 15.5 35.7 8.2 63.8 17.6
3 0.423 3.1 52.5 30.0 7.5 12.5 26.9 5.6 52.5 11.1
4 0.385 7.1 53.0 35.4 3.9 21.5 31.9 6.7 71.3 13.5

class(da1$Transp)
[1] "numeric"
hist(da1$Transp)
hist(da1$log.Transp)

Error in hist.default(da1$log.Inc) : 'x' must be numeric

I checked quite a few blogs and help pages which says variable should be converted to numeric but my is already numeric so unable to figure out what could be going wrong. Could someone please help. Thanks in advance. Regards

I do not see a column named log.Transp or log.Inc in your data. Are you trying to plot a histogram of the log of the column? You can do that with code like

hist(log10(da1$Transp))

Hi FJCC

Yes, I was trying to plot histogram of the log of column.
Thank you so much for help.

Regards
Rajz

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.