getAllEventTypes: getAllEventTypes

Description Usage Author(s) Examples

Description

Betfair getAllEventTypes

Usage

1

Author(s)

colin@betwise.co.uk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function()
{
  x <- .bfapi(match.call())

  x <- .xmlp('eventTypeItems', x)
  a1 <- unlist(strsplit(x,"><"))
  a2 <- a1[grep(".*>.*<.*",a1)]
  l  <- unique(sub("[ >].*","",a2))  # labels
  v  <- sub(".*>(.*)<.*","\1",a2)   # values
  m  <- matrix(v, ncol=length(l), byrow=T)
  colnames(m) <- l
  x <- as.data.frame(m, stringsAsFactors=FALSE)
  rownames(x) <- as.character(x[,1])
  x[,1] <- as.integer(x[,1])
  x[,3] <- as.integer(x[,3])
  x[,4] <- as.integer(x[,4])
  x
  }

bwlewis/betfair documentation built on May 13, 2019, 9:05 a.m.