json - speed and memory comparison between rowwise with do and transmute -
i wondering, memory , speed comparison between rowwise , transmute function in dplyr
i have list in data frame column, want know 1 better. currently, due limited knowlege, using rowwise collect information list,
i have 3 column.
first column unique id each row. second column json response third column list extracted json response following code
vectorize_fromjson <- vectorize(fromjson) z <- vectorize_fromjson(x)
example of json response
x extracted 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, extract company_name json response follows:
data_df$json_list <- z data_df %>% rowwise %>% do(company_name = .$json_list$company_name)
i not able use transmute or mutate company name list.
main question, how efficient rowwise compare transmute ?
Comments
Post a Comment