Hi,
I have this small data frame:
source <- data.frame(
stringsAsFactors = FALSE,
URN = c("VE2238212", "VE874","VE7306","VE21019",
"VE215","VE21547","VE25668",
"VE21552","VE2133","VE21548","VE21581","VE21512"),
ROTotal = c(199.21,179,165.58,224.99,
149.11,998.56,210.83,735,262.22,167.49,168.21,498.4),
PostcodeShort = c("AB33","AL8","B15","B16",
"B24","BA1","BA12","W10","W13","W8 7","WA10","WA11")
)
where I would like to add one more variable with just prefix letters from the PostcodeShort.
Selecting first wo characters is not working as I should have B and BA, W and WA (not B1, B2, BA, W1, W8 ,WA).
Can you help?