I have the following simple dataset (a small section shown below) and want to produce a histogram from this using R studio (I am able to do this using Excel).
Samples Number.of.OTUs
A 13
B 10
C 9
D 9
The dataset has been read in using the following command;
MD1 = read.csv("MD_qual_OTU_sorted_2.csv")
when I try to make a histogram I get this error
hist(MD1)
Error in hist.default(MD1) : 'x' must be numeric
and this when I try barplot
barplot(MD1)
Error in barplot.default(MD1) : 'height' must be a vector or a matrix
attributes(MD1)
# $names
# [1] "Samples" "Number.of.OTUs"
# $class
# [1] "data.frame"
# $row.names
# [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
I know I could enter the data by hand in R but I want to be able to read in the CSV file preferably.
I have tried the solutions in the question marked as duplicate, but to no avail.