0
$\begingroup$

I am new to R and I am trying to plot a histogram from one of the columns in my csv file. The table is already being read perfectly as I can check on R Studios date view. I also can plot histograms of vectors i create using a simples control like:

X <- 1:100 hist(x)

However, when i try to plot from my table, it says: Error in hist(b) : object 'b' not found

My table as a header, and i can check it using the command: names(data)

Why can't i seem to plot the histogram from my read data?

Thanks

$\endgroup$
1
  • 5
    $\begingroup$ I'm voting to close this question as off-topic because it is not about quantitative finance. While you might want to plot financial data, this is a general R question that is probably better suited for Stack Overflow. $\endgroup$ Nov 15 '17 at 9:05
1
$\begingroup$

Check your global environment if the data is a numeric or integer. You may get an error if it is reading in as a character string, etc.

Also you should be referencing the column name in your code assuming you have multiple columns being pulled in. Like this hist(foo$bar).

Suggest you look at ggplot's histograms here.

$\endgroup$
1
  • $\begingroup$ I explicitly recommend ggplot2. It takes a while to learn the syntax but its worth it. $\endgroup$
    – vanguard2k
    Nov 15 '17 at 12:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.