cleanCols: Function to clean sensata data

View source: R/cleanCols.R

cleanColsR Documentation

Function to clean sensata data

Description

This function eliminates the unnecesary metadata columns and renames the columns from mongo to the identifier, according to the dictionary.

Usage

cleanCols(
  df,
  dictionary,
  colsToKeep = c("id", "surveyName", "surveyId", "totalTimeMin",
    "geolocation.coordinates", "lat", "long", "geo.accuracy", "fingerprint",
    "browserReport.ip", "sensataId", "createdAt"),
  removeParams = FALSE,
  removeScreens = TRUE,
  responseType = "newResponses"
)

Arguments

df

data downloaded from Mongo and loaded to R.

dictionary

dictionary created with dictGenerator.R

colsToKeep

vector of names of metadata columns to keep. Defaults to: id, surveyName, surveyId, totalTimeMin, geolocation.coordinates, fingerprint, browserReport.ip and, createdAt. All questions are always included.

removeParams

logical, if TRUE params from mongo are removed.

removeScreens

logical, if TRUE screens are removed

responseType

which object version should the function use, one of "newResponses" or "structuredResponses"

Value

Dataframe with renamed fewer metadata and renamed selected answers as the question identifier.

Author(s)

Gabriel N. Camargo-Toledo gcamargo@sensata.io

Examples

bogData <- bogData %>% cleanCols(dictionary = bogDic)

SensataUX/sensataDataProg documentation built on April 18, 2023, 3:48 p.m.