Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with double columns. I need double but bigrquery brings integer to me #624

Open
joscani opened this issue Oct 26, 2024 · 1 comment

Comments

@joscani
Copy link

joscani commented Oct 26, 2024

In https://bigrquery.r-dbi.org/ I read this

library(dplyr)

natality <- tbl(con, "natality")

natality %>%
  select(year, month, day, weight_pounds) %>% 
  head(10) %>%
  collect()

and get

#> # A tibble: 10 × 4
#>     year month   day weight_pounds
#>    <int> <int> <int>         <dbl>
#>  1  2005     5    NA          7.56
#>  2  2005     6    NA          4.75
#>  3  2005    11    NA          7.37
#>  4  2005     6    NA          7.81
#>  5  2005     5    NA          3.69
#>  6  2005    10    NA          6.95
#>  7  2005    12    NA          8.44
#>  8  2005    10    NA          8.69
#>  9  2005    10    NA          7.63
#> 10  2005     7    NA          8.27

but trying to get the same using my billing project

con <- dbConnect(
  bigrquery::bigquery(),
  project = "publicdata",
  dataset = "samples",
  billing = billing
)

natality <- tbl(con, "natality")

natality  |> 
  select(year, month, day, weight_pounds)  |>  
  head(4)

I get

Job complete
Billed: 3.76 GB
Streamed 4 rows in 1 messages.                                                                   
# Source:   SQL [4 x 4]
# Database: BigQueryConnection
   year month   day weight_pounds
  <int> <int> <int>         <int>
1  2005    11    NA             8
2  2005     1    NA             8
3  2005     3    NA             7
4  2005     7    NA             7

Is a problem , because I need to summarise and get target (0, 1 variable) averages for a group, and only gets 1 or 0 not te proportion.

And If I upload a dataframe like mtcars for example to a bigquery table . double columns in dataframe are changed to integer columns.

Any idea? Thanks

@joscani
Copy link
Author

joscani commented Oct 26, 2024

Ok. The problem is with the newest development release. If I remove package and install again with

install.packages("bigrquery")

all runs smoothly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant