influxdb-r icon indicating copy to clipboard operation
influxdb-r copied to clipboard

Fixed using lapply/sapply

Open svazzole opened this issue 8 years ago • 4 comments

@beckettsean @jcheng5
Thanks for your comments. I've changed the influxdb_query function following your suggestions. Now it should return a list of named dataframes (one for every table in the query). The response_data object which is obtained after

response_data <- rjson::fromJSON(rawToChar(response$content))

is a tangled list (especially for queries on multiple tables). Simon

svazzole avatar Mar 10 '16 09:03 svazzole

please have a look at my influxdbr package repository. I am currently updating some functions to handle default influxdb statements.

dleutnant avatar Mar 10 '16 09:03 dleutnant

Man... Great work! You saved me a lot of time! Thanks! Just a couple of questions:

  1. why don't you "merge" your repo with this one?
  2. i've seen that your package returns a xts object "splitted" by columns (or better: a list of xts objects one for every column). Shouldn't be better to have one time series with multiple columns?

svazzole avatar Mar 10 '16 10:03 svazzole

Thanks for your comment @svazzole! It returns a list of xts objects to handle different column types. This is due to the fact that xts objects are based on a matrix and store one data type only. E.g. if your measurement field_value_1 of field_key_1 is a numeric and field_value_2 of field_key_2 is a character, the xts object would consists of a character matrix. If you would like to cirumvent this, you can still use the function parameter return_xts = FALSE which then results a data.frame. However, if this slows the overall usage, I'll have a look and may consider structural changes.

Finally, I am happy to merge to influxdb-r repro! Maybe my code needs some revisions beforehand? @beckettsean Any suggestions?

dleutnant avatar Mar 10 '16 10:03 dleutnant

@dleutnant as of right now yours is the only R library we mention on the client library page. There's no mention of influxdata/influxdb-r.

My preference would be to make you the maintainer of influxdata/influxdb-r and then you can decide the best way forward for the repo, whether that's a merge or just updating the README to point to your project.

@toddboom @jcheng5 does that work for you?

beckettsean avatar Mar 10 '16 21:03 beckettsean