I'm sure this will be a very straight forward answer. I am new to R and still finding my around it's data types. Currently importing data from MySQL however I can't quite figure out how to separate the columns bracketed inside a WKT point type.
I am running the following statement which involves a query to a shapefile contained within a database.
mydb = dbConnect(MySQL(), user='root', password='mrwolf',dbname='jtw_schema', host='localhost')
strSQL = "select sa2_main11, astext(shape) as geom from centroids
where (gcc_name11 = 'Greater Sydney')
and (sa4_name11 != 'Central Coast')
and (sa4_name11 not like '%Outer West%' )
and (sa4_name11 not like '%Baulkham Hills%')
and (sa4_name11 not like '%Outer South West%')"
dfCord = dbGetQuery(mydb, strSQL)
Which results in:
sa2_main11 geom
1 116011303 POINT(150.911550090995 -33.7568493603359)
2 116011304 POINT(150.889312296536 -33.7485997378428)
3 116011305 POINT(150.898781823296 -33.7817496751367)
4 116011306 POINT(150.872046414103 -33.7649465663774)
....
What I want to achieve is
sa2_main11 Lat Long
1 116011303 150.911550090995 -33.7568493603359
2 116011304 150.889312296536 -33.7485997378428
3 116011305 150.898781823296 -33.7817496751367
4 116011306 150.872046414103 -33.7649465663774
....
Apologies if this is very simple question, but have searched for separating WKT data and couldn't find any examples. Could try string search or similar but I imagine there is probably a "R-ish" way to do it.