I have read in a CSV file and want to run a query on it
The query is in the form
count_a = SELECT sum(A) as COLS FROM file where year = "2012"
I use this:
sum_of_a = all_data = read.csv.sql(data_all, count_a)
I get back
COLS
1 85221
when I print(sum_of_a) - how do I get just the number part? I have tried sum_of_a.values[0] also tried sum_of_a["COLS"] and get the same.
Help?
CodePudding user response:
We may use [[
or $
sum_of_a$COLS
or with [[
sum_of_a[[1]]
In R
, the indexing starts from 1