Postgresql + dplyr: loading bigint as a text column

I connected to the database:

db = src_postgres(dbname = "a", host = "b", port = 5432, user = 'c', password = 'd')
tab = tbl(db, "table")

Then I try to count the number of rows in each group:

tab %>%
  group_by(id) %>%
  tally() %>%
  arrange(desc(n)) 

Result:

         id            n
1     6.014e+18 13529622
2     6.014e+18 10906413
3     6.014e+18  8243263
4     6.011e+18  7472041
5     6.014e+18  7094833
6     6.012e+18  6730177
7     6.011e+18  6236673
8     6.011e+18  5924966
9     6.011e+18  4537380
10    6.011e+18  4393328

Is there a way to access a column idin text form? (something like id::TEXTwill do in the database)

+4
source share
2 answers

You can specify the id column in the text in the database:

tab %>%
  mutate(id = as.character(id)) %>%
  group_by(id) %>%
  tally() %>%
  arrange(desc(n)) 
+2
source

Perhaps you can use:

  format(id, scientific = FALSE)
0
source

All Articles