1

I have a problem with import table using RPostgreSQL. I mean, one column is bigint format, and when I create simple query:

df<- dbGetQuery(con, "
                     SELECT euid
                     FROM table
                     LIMIT 5;")

I received

       euid
1 6.011e+18
2 5.010e+18
3 1.001e+18
4 6.012e+18
5 6.013e+18

Of course I do not wat to get logarithic notation. Instead just the same euid number as I have in database.

When I use options(scipen=999) I get

                 euid
 1 6011000000000000000
 2 5010000000000000000
 3 1001000000000173312
 4 6012000000000000000
 5 6013000000000000000

but real euid number in database is

          euid
   ---------------------
   6011000000000000150
   5010000000000000240
   1001000000000173341
   6012000000000000117
   6013000000000000119

It is possible to import all column in character format?

1 Answer 1

2

Casting euid to TEXT should help, as this way it will not be treated as a numeric value.

df<- dbGetQuery(con, "
                     SELECT euid::TEXT
                     FROM table
                     LIMIT 5;")
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Krzysztof! You save my life!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.