I would like to transform a column of values into data that R will read as frequency. For example, if I counted 3 birds at one location, I would like that to show up as three rows, each row with one bird. In other words, I would like to go from df1 to df2:
df1 <- data.frame(lat = c(35, 40, 42),
lon = c(-96, -101, -97),
nbird = c( 2, 4, 2))
df2 <- data.frame(lat = c(35, 35, 40, 40, 40, 40, 42, 42),
lon = c(-96, -96, -101,-101, -101, -101, -97, -97),
nbird = c( 1, 1, 1, 1, 1, 1, 1, 1))