data(mtcars) mtcars$Model = rownames(mtcars) rownames(mtcars) = NULL dim(mtcars) hp_max = max(mtcars$hp) mtcars[mtcars$hp == hp_max,] # to split the data list_model = strsplit(mtcars$Model," ") # this thing can be done with sapply list_model[[1]][1] list_model[[2]][1] list_model[[3]][1] # to extract brand name v_brand = sapply(list_model, FUN = '[',n=1) mtcars$Brand = v_brand #mtcars sapply(list_model, FUN = '[',n=2) lp = lapply(list_model, FUN = '[',n=1) # these both will work but sapply will return vector where as lapply will return list.
To embed this project on your website, copy the following code and paste it into your website's HTML: