OHDSI / Andromeda

AsynchroNous Disk-based Representation of MassivE DAta: An R package aimed at replacing ff for storing large data objects.
https://ohdsi.github.io/Andromeda/
11 stars 13 forks source link

data import error for death.csv CDM like file #24

Closed vojtechhuser closed 3 years ago

vojtechhuser commented 3 years ago

in newest dev version - error is obtained when user tries to import this file into andr<-andomeda()

andr=andromeda()
url2='https://physionet.org/content/mimic-iv-demo-omop/0.9/1_omop_data_csv/death.csv'
death=read_csv(url2)
str(death)
andr$death <- death

# Error in (function (classes, fdef, mtable)  : 
#             unable to find an inherited method for function ‘dbWriteTable’ for signature ‘"Andromeda", "character", "spec_tbl_df"’
ablack3 commented 3 years ago

With a few tweaks I got it working. I had to use a different url.

library(Andromeda)
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
andr <- andromeda()
url <- "https://physionet.org/files/mimic-iv-demo-omop/0.9/1_omop_data_csv/death.csv"
death <- readr::read_csv(url)
#> 
#> -- Column specification --------------------------------------------------------
#> cols(
#>   person_id = col_double(),
#>   death_date = col_date(format = ""),
#>   death_datetime = col_datetime(format = ""),
#>   death_type_concept_id = col_double(),
#>   cause_concept_id = col_double(),
#>   cause_source_value = col_logical(),
#>   cause_source_concept_id = col_double()
#> )

death
#> # A tibble: 15 x 7
#>    person_id death_date death_datetime      death_type_concept~ cause_concept_id
#>        <dbl> <date>     <dttm>                            <dbl>            <dbl>
#>  1  -2.31e18 2116-07-05 2116-07-05 08:05:00               32817                0
#>  2  -7.67e18 2115-10-12 2115-10-12 00:00:00               32817                0
#>  3   1.19e18 2177-03-29 2177-03-29 14:15:00               32817                0
#>  4   5.79e17 2117-03-24 2117-03-24 00:01:00               32817                0
#>  5  -4.35e18 2146-07-12 2146-07-12 00:00:00               32817                0
#>  6   4.35e18 2135-01-19 2135-01-19 18:36:00               32817                0
#>  7   2.21e18 2186-11-17 2186-11-17 18:30:00               32817                0
#>  8   6.34e18 2111-11-15 2111-11-15 17:20:00               32817                0
#>  9  -3.91e18 2137-09-02 2137-09-02 17:05:00               32817                0
#> 10   4.78e18 2116-03-12 2116-03-12 07:45:00               32817                0
#> 11   2.60e18 2137-10-09 2137-10-09 15:30:00               32817                0
#> 12  -6.26e17 2175-07-20 2175-07-20 00:00:00               32817                0
#> 13  -8.66e18 2155-12-07 2155-12-07 15:30:00               32817                0
#> 14  -9.07e18 2185-01-22 2185-01-22 14:25:00               32817                0
#> 15  -2.50e18 2201-07-13 2201-07-13 23:27:00               32817                0
#> # ... with 2 more variables: cause_source_value <lgl>,
#> #   cause_source_concept_id <dbl>

andr$death <- death

andr$death
#> # Source:   table<death> [?? x 7]
#> # Database: sqlite 3.35.5
#> #   [C:\Users\ADAM~1.DES\AppData\Local\Temp\Rtmpwv5r5R\file39b8fed4879.sqlite]
#>    person_id death_date death_datetime      death_type_concept~ cause_concept_id
#>        <dbl> <date>     <dttm>                            <dbl>            <dbl>
#>  1  -2.31e18 2116-07-05 2116-07-05 08:05:00               32817                0
#>  2  -7.67e18 2115-10-12 2115-10-12 00:00:00               32817                0
#>  3   1.19e18 2177-03-29 2177-03-29 14:15:00               32817                0
#>  4   5.79e17 2117-03-24 2117-03-24 00:01:00               32817                0
#>  5  -4.35e18 2146-07-12 2146-07-12 00:00:00               32817                0
#>  6   4.35e18 2135-01-19 2135-01-19 18:36:00               32817                0
#>  7   2.21e18 2186-11-17 2186-11-17 18:30:00               32817                0
#>  8   6.34e18 2111-11-15 2111-11-15 17:20:00               32817                0
#>  9  -3.91e18 2137-09-02 2137-09-02 17:05:00               32817                0
#> 10   4.78e18 2116-03-12 2116-03-12 07:45:00               32817                0
#> # ... with more rows, and 2 more variables: cause_source_value <int>,
#> #   cause_source_concept_id <dbl>

Created on 2021-07-09 by the reprex package (v2.0.0)