This dataframe contains a columns TX_JAN_2019_DF$AREA (type: numeric) and TX_JAN_2019_DF$DEVICE_HOME_AREA (type: character)
TX_JAN_2019_DF$AREA[1] produces:[1] 481210216382
TX_JAN_2019_DF$DEVICE_HOME_AREA[1] produces a sample of the string (for this benefit of this post, this output is greatly reduced):
"{\"481210216382\":307,\"481210216371\":50,\"481210216381\":43,\"481130137213\":35,\"481210216373\":27,\"481130137222\":21,\"481210216154\":21,\"481210216152\":17,\"481210216133\":15,\"481210216372\":4}"
As you can see the json string is a string of values type character. I need to pattern match the first column TX_JAN_2019_DF$DEVICE[1], to see if the second column element TX_JAN_2019_DF$DEVICE_HOME_AREA[1] and the json string stored in that element contains the pattern and if it does, what is the number after the colon (307 for example in the first element).
Then of course do this for all columns TX_JAN_2019_DF$DEVICE_HOME_AREA
I'm at a loss on how to do this as the json adds a complication to normal pattern matching. I've looked at the jsonlite library, but the examples are not much help.
Thank you in advance
0 comments:
Post a Comment
Thanks