mathedjoe / animaltracker

Visualize and analyze GPS data for cows (and other animals).
5 stars 6 forks source link

Number of Satellites #44

Closed angmal7 closed 4 years ago

angmal7 commented 4 years ago

I have a piece of R code that can determine the number of satellites, could you maybe incorporate this into the app so it gives the number of satellites and not the X and dashes.

`# Get number of satellites get_sats<-function(dataset) {

string <- as.character(dataset[,"Satelite"]) s2 <- gsub("X","",string)

num_orig <- nchar(string) num_new <- nchar(s2) num_sat <- num_orig - num_new

return(num_sat) }`

mathedjoe commented 4 years ago

Absolutely! Since we're using dplyr to clean the data, something like the following will do what you're asking:

mutate(nSatelites = nchar(Satelite) - nchar( gsub("X", "", Satelite)))

@ttsukianto , can you get this into the data cleaning function? (specifically for iGotU data)

dylanmikesell commented 4 years ago

What are people's thoughts on making a standardized output for download once the data are cleaned, i.e. when someone downloads a cleaned data set from AnimalTracker, the file looks the same whether the input file was a igout or P1 Columbus? The P1 columbus for example gives the number of satellites, whereas we need to use the code above to get the number of satellites for igotu. Is that something we can all chat about in terms of what we need to output in the downloaded file? I think before we just dumped everything that was in the original igotu dataset.

mathedjoe commented 4 years ago

Agreed! The current design of the app is already set-up for that (files are cleaned separately by format, then merged into a standardized set of fields). It's worth chatting about what fields should be in the processed output.

ttsukianto commented 4 years ago

@mathedjoe I've got it implemented as of pull request #45.