Skip to content

Commit

Permalink
final performance optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
oweno-tfwm committed Sep 8, 2023
1 parent 3d57ad8 commit 8b47e7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/atoc_import.R
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,9 @@ process_activity <- function(dt, public_only) {

activity = sprintf("%s,%s,%s,%s,%s,%s", splitActivityMat[,1], splitActivityMat[,2], splitActivityMat[,3], splitActivityMat[,4], splitActivityMat[,5], splitActivityMat[,6] )

#remove whitespace, replace multiple comma with single comma, remove leading comma, remove trailing comma.
dt$Activity <- gsub(",$", "", gsub("^,", "", gsub(",+", ",", gsub("\\s+", "", activity))))
#replace multiple comma with single comma, remove whitespace, remove leading comma, remove trailing comma.
activity = gsub(",+", ",", activity)
dt[, Activity := gsub("\\s+|^,|,$", "", activity)]

#remove rows with no activity we're interested in
dt <- dt[ ""!=dt$Activity ]
Expand Down

0 comments on commit 8b47e7a

Please sign in to comment.