IF and AND statement in R /R Studio -


this question has answer here:

my data looks this:

point   code  area  1.001   231   10 1.001   231   20 1.002   211   45 1.002   211   20 1.002   211   30 1.002   231   20 1.002   231   20 1.002   231   110 

where each point unique value, each code unique, , area area associated each code.

i'm trying merge values in case point values same , code values same, areas under each code added together, , final resulting table looks following:

point   code    totarea 1.001   231     30 1.002   211     95 1.002   231     150 

any suggestions?

my file sizes massive ( > 1 million rows), , i'm new r.

you can use package dplyr:

library(dplyr)  data %>% group_by(point,code) %>%          summarise(totarea = sum(area)) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -