Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

r - Plot Single Column Data File Histogram in RStudio

How can I display a histogram with 20 bins for the attached file? The two lines of code I attempted to use are shown below.

d=read.table("wgci_mAdc2.csv") hist(d)

I get an error message which says, "Error in hist.default(d) : 'x' must be numeric"

My data file looks something like the list below. 86.60 91.40 85.30 86.90 89.60 58.40 59.00 58.80 58.60 89.20 91.90 90.60 88.10 89.20 84.40 88.90 85.00 58.30 57.60 58.10 89.80 58.00 91.50 58.10 57.40 58.00 90.10 58.10 58.90 57.70 91.80 58.70 91.80 58.40 57.40 58.00 87.60 95.20 91.20 88.00 82.90 92.60 89.00

question from:https://stackoverflow.com/questions/65921008/plot-single-column-data-file-histogram-in-rstudio

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your data is not recognised as numeric. Have you tried as.numeric() ?

d=read.table("wgci_mAdc2.csv")
d =as.numeric(unlist(d))
hist(d)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...