Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Dealing with data gaps #12

Open
franzmohr opened this issue Feb 25, 2023 · 1 comment
Open

Feature request: Dealing with data gaps #12

franzmohr opened this issue Feb 25, 2023 · 1 comment

Comments

@franzmohr
Copy link
Owner

Check, how data gaps in the time index within a group could be dealt with.

@SebKrantz
Copy link

SebKrantz commented Feb 26, 2023

Just saw this issue after reading your comment. collapse::fdiff(x, g = group, t = time, rho = param) deals with this if the time index is integer. Otherwise, you can use collapse::timeid(time), which creates integer steps from any numeric vector based on the greatest common divisor.

library(collapse)
head(D(wlddev[-3, ], by = ~ iso3c, t = ~ year))
#>   iso3c year D1.decade D1.PCGDP D1.LIFEEX D1.GINI    D1.ODA D1.POP
#> 1   AFG 1960        NA       NA        NA      NA        NA     NA
#> 2   AFG 1961         0       NA     0.516      NA 115310005 172437
#> 4   AFG 1963        NA       NA        NA      NA        NA     NA
#> 5   AFG 1964         0       NA     0.492      NA  58200012 201576
#> 6   AFG 1965         0       NA     0.485      NA  45919983 211539
#> 7   AFG 1966         0       NA     0.482      NA -30230011 218516
head(with(wlddev[-3, ], fdiff(LIFEEX, 1, 1, iso3c, year)))
#> [1]    NA 0.516    NA 0.492 0.485 0.482

Created on 2023-02-26 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants