I'm quite a beginner with R and I'm playing round with some deprivation data which I've read into a DataFrame in the following form:
FeatureCode DateCode Measurement Units Value `DCLG Homelessness Acceptances Ratio Concept Scheme`
<chr> <dbl> <chr> <lgl> <dbl> <chr>
1 E06000021 2017. Homelessness-Acceptances NA 0.47 Acceptances per thousand households
2 E06000021 2016. Homelessness-Acceptances NA 0.35 Acceptances per thousand households
3 E06000021 2018. Homelessness-Acceptances NA 0.51 Acceptances per thousand households
4 E06000021 2019. Homelessness-Acceptances NA 0.49 Acceptances per thousand households
5 E06000022 2012. Homelessness-Acceptances NA 0.43 Acceptances per thousand households
6 E06000022 2011. Homelessness-Acceptances NA 0.64 Acceptances per thousand households
7 E06000022 2013. Homelessness-Acceptances NA 0.64 Acceptances per thousand households
8 E06000022 2016. Homelessness-Acceptances NA 0.51 Acceptances per thousand households
9 E06000023 2011. Homelessness-Acceptances NA 0.6 Acceptances per thousand households
10 E06000023 2014. Homelessness-Acceptances NA 0.71 Acceptances per thousand households
11 E06000023 2013. Homelessness-Acceptances NA 0.71 Acceptances per thousand households
12 E06000023 2015. Homelessness-Acceptances NA 0.71 Acceptances per thousand households
This is just a snippet of the data. Now what I want to do is create a new DataFrame that has a named row for each unique value of FeatureCode
and a column for each unique value of DateCode
, and the DataFrame is then filled with the corresponding Value
.
So the end result I want is something like:
2011. 2012. 2013. 2014. 2015. 2016. 2017. 2018. 2019.
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
E06000021 NA NA NA NA NA 0.35 0.47 0.51 0.49
E06000022 0.64 0.43 0.64 NA NA 0.51 NA NA NA
E06000023 0.6 NA 0.71 0.71 0.71 NA NA NA NA
I don't really know where to start, can anyone help? Thanks