How to fix datatype of variables when upload data from R to DOMO?

Options

Hi,

I am trying to upload a data frame from R environment to Domo using ds_update. One challenge that I am facing is that somehow DOMO automatically changed one column into Date, from numeric.

Because the value in that column ranged from 0 to around 890 thousand, I guess DOMO thought they were numerical date… (like in Excel).

Now I cannot switch them back to numeric either, DOMO said it does not support such operations.

What can I do to ensure the type of data when I upload from R?
Thank you


Answers

  • GrantSmith
    Options

    rdomo doesn't support defining the dataset's schema when you upload it. It attempts to determine the schema automatically. With your numbers it fails the first two checks where it's looking for a specific date format however the third check attempts to conver the number to a date which succeeds so it assumes it's a date. You can search for "typeConversionText=function(data, colindex)" on  https://rdrr.io/github/domoinc/rdomo/src/R/rdomo.R

     to see the actual R code.

    The Python pydomo package does support defining a schema manually so that your data will be uploaded with the correct types if you're willing to use Python:

    https://github.com/domoinc/domo-python-sdk/blob/master/examples/dataset.py#L13

    Alternatively, you may be able to use a Magic ETL to change the data type with an Alter Column tile.

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • quachtoanlong
    Options

    Hi GrantSmith, thank you for your suggestion.

    So I am still not sure why my data is catagorized as Date; but I have tried to convert back to numeric using Magic ETL. However, somehow the ETL returned an error suggesting that the date format cannot be converted to numeric.

    Do you have any suggestions for investigate?

    Thanks!

  • GrantSmith
    Options

    What do the raw numbers look like and what is the date they get translated to? I’m wondering if it’s assuming they’re Unix timestamps and you can convert them back to Numbers by using the TO_UNIXTIME function in a formula tile

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • quachtoanlong
    Options

    Hi GrantSmith, thank you for getting back so quickly.

    The format is very … numeric. They are just pure number, such as 4, 1116, 846984. It ranges from 4 to 846984.

    I also guess that somehow the function thought they are Date Number …. Let me try this TO_UNIXTIME