I have collected several different datasets and formatted them into one and it looks something like this:
df <- data.frame(database = c("A","A","A","B","B","B","C","C","C"),
longitude = c(45,45,45,11,11,11,43,43,43),
latitude = c(12,12,12,42,42,42,12,12,12),
interval = c(0,2,2,2,0,4,0,2,3))
I noticed that from one of the datasets longitude and latitude are switched around. So for database==B I want to switch the values between the longitude and latitude columns. So it ends up like this:
df1 <- data.frame(database = c("A","A","A","B","B","B","C","C","C"),
longitude = c(45,45,45,42,42,42,43,43,43),
latitude = c(12,12,12,11,11,11,12,12,12),
interval = c(0,2,2,2,0,4,0,2,3))