Question: Using Google Analytics [Sessions API](https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=session&jump=ga_sessions) I can get the total hits (i.e. total page views and events etc) in a session. 

Is there a way to get a list of all the page views and events that took place in a session? If this data cannot be obtained using core reporting API can it be exported to BigTable if Google Analytics Premium is used?

Answer: 
We should first locate the columns that will be adjusted. We do this according to your description as the columns from `Al` to `Zn`. Next we `sub` unnecessary characters and convert to `numeric` with the `numerize` function. I added more columns to show the complexity:

```
cols <- match("Al", names(df)):match("Zn", names(df))
numerize <- function(x) as.numeric(sub(".*?([0-9.-]+).*", "\\1", x))

#base R
df[cols] <- lapply(df[cols], numerize)

#dplyr
df %>% mutate_at(vars(Al:Zn), numerize)

#data.table
setDT(df)[, (names(df)[cols]) := lapply(.SD, numerize), .SDcols=cols][]

#   columnNum Al Yw Zn Ca
# 1        G1  5  8  1  9
# 2        G2  6  6  6 10
# 3        G3  7  7  7 11
# 4        G1  4  4  4 10
# 5        G2  5  5  5 11
# 6        G3  6  6  6 12

```

**Data**

```
columnNum <- c("G1", "G2", "G3")
Al <- c("<5", 6, 7, "<4", 5, 6)
Yw <- c("<8", 6, 7, "<4", 5, 6)
Zn <- c("<1", 6, 7, "<4", 5, 6)
Ca <- c(9, 10, 11,10, 11, 12)
df <- data.frame(columnNum, Al, Yw, Zn, Ca, stringsAsFactors = FALSE)

```
`tidyr::extract_numeric` is handy, whether in `dplyr` or not:

```
df$Al <- tidyr::extract_numeric(Al)    # or df %>% mutate(Al = extract_numeric(Al))

```

which is roughly equivalent to

```
df$Al <- as.numeric(sub('.*(-?[0-9]+.?[0-9]*).*', '\\1', df$Al))

```

which for this particular case could be simplified to:

```
df$Al <- as.integer(sub('<', '', df$Al))

```

Regardless of which you use, for this data you get:

```
##   columnNum Al Ca
## 1        G1  5  9
## 2        G2  6 10
## 3        G3  7 11
## 4        G1  4 10
## 5        G2  5 11
## 6        G3  6 12

```