Open kirstenronning opened 4 years ago
It's strange because it's working fine for me:
> CenDF <- CenDF %>%
+ mutate( variable = case_when(
+ variable == "B25077_001" ~ "HouseValue",
+ variable == "B19013_001" ~ "HHIncome") ) %>%
+ select( -moe ) %>%
+ spread( variable, estimate ) %>%
+ mutate( HHInc_HousePrice_Ratio = round(HouseValue/HHIncome,2) )
>
> head( CenDF )
Simple feature collection with 6 features and 5 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 1085367 ymin: -1419116 xmax: 1390214 ymax: -1045061
CRS: +proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs
GEOID NAME HHIncome HouseValue
1 01001 Autauga County, Alabama 55317 143000
2 01009 Blount County, Alabama 47412 122200
3 01017 Chambers County, Alabama 37342 86400
4 01021 Chilton County, Alabama 43501 98600
5 01033 Colbert County, Alabama 45477 108500
6 01045 Dale County, Alabama 44711 108000
geometry HHInc_HousePrice_Ratio
1 MULTIPOLYGON (((1269841 -13... 2.59
2 MULTIPOLYGON (((1240383 -11... 2.58
3 MULTIPOLYGON (((1382944 -12... 2.31
4 MULTIPOLYGON (((1257515 -12... 2.27
5 MULTIPOLYGON (((1085910 -10... 2.39
6 MULTIPOLYGON (((1382203 -13... 2.42
What are your previous steps? Can you share your session info?
sessionInfo()
Hello,
I am receiving an Error Message on my Step 2, even though I am running nearly identical code to this example. The error message is:
Error: Each row of output must be identified by a unique combination of keys. Keys are shared for 6284 rows: * 1, 2 * 3, 4 * 5, 6 * 7, 8 * 9, 10 * 11, 12 * 13, 14 * 15, 16 * 17, 18 * 19, 20 * 21, 22 * 23, 24 * 25, 26 * 27, 28 * 29, 30 * 31, 32 * 33, 34 * 35, 36 * 37, 38 * 39, 40 * 41, 42 * 43, 44 * 45, 46 * 47, 48 * 49, 50 * 51, 52 * 53, 54 * 55, 56 * 57, 58 * 59, 60 * 61, 62 * 63, 64 * 65, 66 * 67, 68 * 69, 70 * 71, 72 * 73, 74 * 75, 76 * 77, 78 * 79, 80 * 81, 82 * 83, 84 * 85, 86 * 87, 88 * 89, 90 * 91, 92 * 93, 94 * 95, 96 * 97, 98 * 99, 100 * 101, 102 * 103, 104 * 105, 106 * 107, 108 * 109, 110 * 111, 112 * 113, 114 * 115, 116 * 117, 118 * 119, 120 * 121, 122 * 123, 124 * 125, 126 * 127, 128 * 129, 130 * 131, 132 * 133, 134 * 135, 136 * 137, 138 * 139, 140 * 141, 142 * 143, 144 * 145, 146 * 147, 148 * 149, 150 * 151, 152 * 153, 154 * 155, 156 * 157, 158 * 159, 160 * 161, 162 * 163, 164 * 165, 166 * 167, 168 * 169, 170 * 171, 172 * 173, 174 * 175, 176 * 177, 178 * 179, 180 * 181, 1
The code I am working with is:
I am finding that the error is associated with spread(), but I am not understanding how to fix this. It appears that I can't move onto the next steps in this lab while this error is occurring.