Giter Site home page Giter Site logo

indicator's People

Contributors

antaldaniel avatar kkulma avatar pitkant avatar

Watchers

 avatar  avatar  avatar

Forkers

pitkant

indicator's Issues

Update README

Add a package description with the most representative examples / links to vignettes to README file

test databases

@pitkant , can you please share the code that created the three test dbs....
I would like to see if it works now without a problem with the new metadata.

indicator s3 class

I created an s3 class for the manual creation or singular importing of indicators. The main idea is explained in the vignette, i.e. force individual dataset contributions to match the schema of the API/database; and to help such conversions.

I also slightly alterred some metadata in the Eurostat import. I think that the main task now is to agree on a final look of how an indicator should be in the database, API, because both the API and the automatic documentation will build on this -- it will be more and more difficult to make structural changes.

Replace time-related computation with {time_tk} and {modeltime}

Current time-wise imputation is partly based on zoo, and forecast., and partly on time_tk and it ecosystem. time_tk is much better integrated with tidyverse, and its ecosystem is developing faster.

Change all zoo/forecast approximation, forecasting and backcasting to time_tk and modeltime (which is also tidymodels compatible)

Unify output of test_unique_observations()

Currently, test_unique_observations() produces the following outputs:

  • TRUE if there are no duplicates in the indicator table
  • error message if there are duplicates and stop_on_error = TRUE
  • FALSE and a data frame if there are duplicates and stop_on_error = FALSE

I suggest that we unify these outputs, e.g.

  • write a helper function is_unique_indicator() that returns either TRUE or FALSE
  • write a separate function show_duplicated_indicators() that returns the duplicated returns only if is_unique_indicator() returns TRUE

I'm open to other suggestions re how we can wrap it all up!

get_eurostat_indicator.R: Error in ncol(value_labelling) : object 'value_labelling' not found

When trying to download e.g. dataset id "nama_10r_3gdp" from eurostat I get the following error:

gdp_nuts3 <- eurostat::get_eurostat(id = "nama_10r_3gdp")

gdp_nuts3_raw <- eurostat::get_eurostat(id = "nama_10r_3gdp") %>% 
  filter (.data$unit %in% c("EUR_HAB"))

gdp_nuts3_indicators <- get_eurostat_indicator(
  preselected_indicators = gdp_nuts3_raw,
  id = "nama_10r_3gdp")

Error in ncol(value_labelling) : object 'value_labelling' not found

This seems to be due to the function skipping if statement on lines 123:145 where the object value_labelling is created and moving to else-part of the if-else where

value_labels <- value_codes # this should be an empty tibble

This causes an error in lines 271:288 since the if-statement is looking for object value_labelling in

if ( ncol(value_labelling)>0 ) {
{...}
}

get_eurostat_indicator.R: Error in is.data.frame(y) : object 'unit_labels' not found

When trying to download dataset id "bd_hgnace2_r3" from eurostat I get the following error:

library(eurostat)
library(dplyr)
library(indicators)

business_demography <- eurostat::get_eurostat(id = "bd_hgnace2_r3")

business_demography_raw <- eurostat::get_eurostat(id = "bd_hgnace2_r3") %>% 
  filter (.data$indic_sb %in% c("V11920", "V11930"),
          .data$nace_r2 == "B-S_X_K642",
          .data$geo %in% unique(business_demography$geo[which(nchar(business_demography$geo) == 2)]))

business_demography_indicators <- get_eurostat_indicator(
 preselected_indicators = business_demography_raw,
 id = "bd_hgnace2_r3")

Error in is.data.frame(y) : object 'unit_labels' not found 

This seems to be due to the function skipping else-part of an if-else statement on lines 177:184 where the object unit_labels is created:

if ( all(is.na(units$unit)) ) {
    units$unit_label <- "[no unit]"
  } else {
    unit_labels <- eurostat::label_eurostat(units) %>%
      mutate ( unit_label = paste0("[", .data$unit, "]")) %>%
      select ( all_of("unit_label")) %>%
      mutate ( unit_label = tolower(as.character(.data$unit_label))) %>%
      bind_cols ( units )
  }

This causes an error in lines 186:192 where the pipe is trying to perform a left_join:

indicator_ext_unit <- indicator_ext %>%
    mutate ( description_indicator =
               snakecase::to_sentence_case(.data$description_indicator) ) %>%
    left_join ( unit_labels, by = c("unit") ) %>%
    unite ( col = "description_indicator",
            all_of (c("description_indicator", "unit_label")),
            sep = " ",
            remove = TRUE) %>%
    unite ( col = "indicator_code",
            all_of (c("indicator_code", "unit")),
            sep = "_",
            remove = FALSE) %>%
    mutate ( indicator_code = snakecase::to_snake_case(.data$indicator_code))

If not there, problems would arise on lines 266:269.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.