Hi, I have a file that I would like to plot within Power BI, however it has Easting/Northing values, I could use grid ref converter or similar to change these, however the file changes daily.
Someone kindly sent me some code to convert Easting/Northings that they got from someone even kinder from the internet... (apologies if this is an amended version of your code, and if so many thanks)...
It works great in R, however I cannot get it to output in Power BI. I am fairly new to both and I think there is a cbind or something missing as I only get the frame dat exported with Reference, Easting and Northing. The conversion to lat/long does not show.
Would be grateful for any suggestions as both libraries are supported, it works in R studio and I have tried the above in both transform data and data load to no avail
`dataset` = read.csv('C:/Temp/R/REditorWrapper_79bcd6a6-2539-4cae-aa3f-5641e41d9a27/input_df_fb67abc2-d23b-4723-b3b2-d2ed2729d001.csv', check.names = FALSE, encoding = "UTF-8", blank.lines.skip = FALSE); dat <-dataset colnames(dat)[c(2, 3)] <- c('Easting', 'Northing') require(rgdal) ukgrid <- "+init=epsg:27700" latlong <- "+init=epsg:4326" coords <- cbind(Easting = as.numeric(as.character(dat$Easting)), Northing = as.numeric(as.character(dat$Northing))) dat_SP <- SpatialPointsDataFrame(coords, data = dat, proj4string = CRS("+init=epsg:27700")) dat_SP_LL <- spTransform(dat_SP, CRS(latlong)) dat_SP_LL@data$Long <- coordinates(dat_SP_LL)[, 1] dat_SP_LL@data$Lat <- coordinates(dat_SP_LL)[, 2] dataset <- dat_SP_LL
Many thanks for your time