Hi
The following code adds an additional column to a tibble using transform
library(tidyverse)
data <-tibble(x = letters, y=letters)
data2 <- data %>%
transform(z = y)
str(data2)
The funny or intended thing is that data2 is now a dataframe and not a tibble anymore. Is this intended or am I doing something wrongly?
'data.frame': 26 obs. of 3 variables:
$ x: chr "a" "b" "c" "d" ...
$ y: chr "a" "b" "c" "d" ...
$ z: Factor w/ 26 levels "a","b","c","d",..: 1 2 3 4 5 6 7 8 9 10 ...
Cheers
Renger