I have an excel sheet setup like below and have loaded as a df:
GPS_Lat GPS_Lon Location
50.70528 -120.44984 0
50.70528 -120.44984 0
50.70527 -120.44984 0
50.70527 -120.44984 0
50.70526 -120.44984 1
50.70526 -120.44984 1
50.70525 -120.44984 1
50.70525 -120.44984 0
50.70524 -120.44984 0
50.70524 -120.44984 0
50.70523 -120.44984 0
50.70523 -120.44984 0
50.70522 -120.44984 0
50.70522 -120.44984 0
50.70521 -120.44984 1
50.70521 -120.44984 1
50.7052 -120.44985 1
50.7052 -120.44985 1
50.70519 -120.44985 0
50.70519 -120.44986 0
50.70518 -120.44986 0
50.70518 -120.44986 0
50.70517 -120.44987 0
50.70517 -120.44987 0
I would like to keep values within 1 m of the first "1" that is encountered when going down the location column and put those values in a new data frame (named: df-n). If there are other sections with 1 values I would like to split those into separate data frames (named: df-n+1) while only keeping the points within 1 m of that first 1 as well. I would like each new data frame to be numbered sequentially. I am completely stumped on this one.
Identify points below automatically and create new data frames with rows that are within 1 m of those points (or any other defined distance) for each with the original data frame name and a suffix of sequential order. Therefore original "df" second "df-1" and "df-2"
I will eventually be using a radius of 10 km and my data set can be up to 20k rows.
EDIT: To provide clarity for outputs. Using hypothetical distances with a radius cutoff of 2 m.
Row GPS_Lat GPS_Lon Location hypothetical_dist_1 hypothetical_dist_2
1 50.70528 -120.44984 0 4 14
2 50.70528 -120.44984 0 3 13
3 50.70527 -120.44984 0 2 12
4 50.70527 -120.44984 0 1 11
5 50.70526 -120.44984 1 0 10
6 50.70526 -120.44984 1 1 9
7 50.70525 -120.44984 1 2 8
8 50.70525 -120.44984 0 3 7
9 50.70524 -120.44984 0 4 6
10 50.70524 -120.44984 0 5 5
11 50.70523 -120.44984 0 6 4
12 50.70523 -120.44984 0 7 3
13 50.70522 -120.44984 0 8 2
14 50.70522 -120.44984 0 9 1
15 50.70521 -120.44984 1 10 0
16 50.70521 -120.44984 1 11 1
17 50.7052 -120.44985 1 12 2
18 50.7052 -120.44985 1 13 3
19 50.70519 -120.44985 0 14 4
20 50.70519 -120.44986 0 15 5
21 50.70518 -120.44986 0 16 6
22 50.70518 -120.44986 0 17 7
23 50.70517 -120.44987 0 18 8
24 50.70517 -120.44987 0 19 9
OUTPUT:
df-1
Row GPS_Lat GPS_Lon Location hypothetical_dist_1
3 50.70527 -120.44984 0 2
4 50.70527 -120.44984 0 1
5 50.70526 -120.44984 1 0
6 50.70526 -120.44984 1 1
7 50.70525 -120.44984 1 2
And
df-2
Row GPS_Lat GPS_Lon Location hypothetical_dist_2
13 50.70522 -120.44984 0 2
14 50.70522 -120.44984 0 1
15 50.70521 -120.44984 1 0
16 50.70521 -120.44984 1 1
17 50.7052 -120.44985 1 2
Basically the workflow is as follows: batch load multiple .csv files into a list, name the list items based on the file names, separate each list item using the radius chosen (into filename-1, filename-2, etc.), plot values in the other columns against each other, and export all of the plots.