So I\'ve figured out how to drill my data down to a frequency table -
Overall.Cond Freq
235 1 0
236 2 0
237 3
I think it should be a barplot, like so:
barplot(dt$Freq, names.arg = dt$Overall.Cond)
You can simply do
myfreq=table(df$columnofinterest)
plot(myfreq)
Rebuild your data frame:
df= as.data.frame(cbind(Overall.Cond= 1:9, Freq= c(0,0,1,1,9,1,1,1,1)))
df
Result:
Overall.Cond Freq
1 1 0
2 2 0
3 3 1
4 4 1
5 5 9
6 6 1
7 7 1
8 8 1
9 9 1
Then make a vector of observations and plot it:
df.freq= as.vector(rep(df$Overall.Cond, df$Freq))
hist(df.freq)
Do you really want a histogram or a bar chart? If you insist on a histogram, you are lacking the upper boundary of your topmost bin; I will assume it is 10.
The solution provided by user2030503 is somewhat wasteful, as it re-creates the data set from the frequency table. Since you already have your frequency table computed, you can use it directly in construction of your histogram object. The latter is essentially a list in R.
Overall.Cond <- 1:10
Freq <- c(0,0,1,1,9,1,1,1,1)
myhist <-list(breaks=Overall.Cond, counts=Freq, density=Freq/diff(Overall.Cond),
xname="Overall Cond")
class(myhist) <- "histogram"
plot(myhist)
As the bin width is 1, calculation of density could be simplified in this case; I just put it for the sake of generality.