Hi I want to use filter in R to filter all the row with selected countrycode, and the data with continuous year from 1950 to 2014
is like
countrycode country currency_unit year rgdpe rgdpo pop emp avh
1 USA United States US Dollar 1950 2279787 2274197 155.5635 62.83500 1983.738
2 USA United States US Dollar 1951 2440076 2443820 158.2269 65.08094 2024.002
3 USA United States US Dollar 1952 2530524 2526412 160.9597 65.85582 2020.183
4 USA United States US Dollar 1953 2655277 2642977 163.6476 66.78711 2014.500
5 USA United States US Dollar 1954 2640868 2633803 166.5511 65.59514 1991.019
6 USA United States US Dollar 1955 2844098 2834914 169.5189 67.53133 1997.761
And my code is :
dat_10 <- filter(data_all_country,countrycode == c("USA","CHN","GBR","IND","JPN","BRA","ZAF","FRA","DEU","ARG"))
The amazing thing is the dat_10
is as the following:
countrycode country currency_unit year rgdpe rgdpo pop emp
1 ARG Argentina Argentine Peso 1954 51117.46 51031.80 18.58889 6.970472
2 ARG Argentina Argentine Peso 1964 69836.62 68879.08 21.95909 7.962999
3 ARG Argentina Argentine Peso 1974 113038.73 110358.46 25.64450 9.135211
4 ARG Argentina Argentine Peso 1984 148994.61 149928.59 29.92091 10.345933
5 ARG Argentina Argentine Peso 1994 379470.19 372903.00 34.55811 12.075872
6 ARG Argentina Argentine Peso 2004 517308.94 499958.94 38.72878 14.669195
as even the valid time-series data is filtered every 10 years, which is the exact number of the country I select as logical variable.
How does this happen and any methods to fix it up ?