I was wondering, what is memory and speed comparison between rowwise with do and transmute function in dplyr
I have list in data frame column, I want to know which one better. Currently, due to my limited knowlege, I am using rowwise with do to collect information from list,
I have three column.
First column is unique id for each row. Second column is JSON response third column is list extracted from JSON response from following code
vectorize_fromJSON <- Vectorize(fromJSON)
z <- vectorize_fromJSON(x)
Example of JSON response
x is extracted from data frame
x =
c('{"company_name": "a", "employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}',
'{"company_name": "a", "employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}')
Currently, I extract company_name from JSON response as follows:
data_df$json_list <- z
data_df %>% rowwise %>% do(company_name = .$json_list$company_name)
I am not able to use transmute or mutate to get company name from list.
Main question, How efficient rowwise is compare to transmute ?