-1

I am four hours into R programming. When I create a barchart from a SQL Script I get all 1's for the bar values. Here are my steps:

states =dbGetQuery(con, "SELECT state, COUNT(*) FROM leads GROUP BY state")

when I do view(out) it give me this: enter image description here

I then try and make a table:

state.freq <- table(states$state)
barplot(state.freq)

I end up with this, basically all 1's??

enter image description here

rafa.pereira
  • 13,251
  • 6
  • 71
  • 109
ja11946
  • 177
  • 1
  • 2
  • 13

1 Answers1

1

Change your query as below dbGetQuery(con, "SELECT state FROM leads") and it should work as expected :)

Naga Sai A
  • 10,771
  • 1
  • 21
  • 40