Learn R Programming

webtrackR (version 0.1.0)

wt_dt: An S3 class, based on data.table, to store web tracking data

Description

An S3 class, based on data.table, to store web tracking data

Convert a data.frame containing web tracking data to a wt_dt object

Usage

as.wt_dt(
  x,
  timestamp_format = "%Y-%m-%d %H:%M:%OS",
  varnames = c(panelist_id = "panelist_id", url = "url", timestamp = "timestamp")
)

is.wt_dt(x)

Value

a webtrack data object with at least columns panelist_id, url

and timestamp

logical. TRUE if x is a webtrack data object and FALSE otherwise

Arguments

x

data.frame containing a necessary set of columns, namely panelist's ID, visit URL and visit timestamp.

timestamp_format

string. Specifies the raw timestamp's formatting. Defaults to "%Y-%m-%d %H:%M:%OS".

varnames

Named vector of column names, which contain the panelist's ID (panelist_id), the visit's URL (url) and the visit's timestamp (timestamp).

Details

A wt_dt table is a data.table. Therefore, it can be used by any function that would work on a data.frame or a data.table. Most of the operation such as variable creation, subsetting and joins are inherited from the data.table [] operator, following the convention DT[i,j,by] (see data table package for detail).

See Also

  • data.table -- on which wt_dt is based

Examples

Run this code
data("testdt_tracking")
wt <- as.wt_dt(testdt_tracking)
is.wt_dt(wt)

Run the code above in your browser using DataLab