'OasisR package - Gorard index applied by subgroup

I'm doing an academic research about segregation in peruvian education. I'm trying to calculate Gorard Index from OasisR, but I want it for every district in the country. I have a table with the number of students of each socioeconomic quartile of every institution, but I'm failing to group it by the district geographical code. As I'm really a noob in R (I've done some courses but I feel this is so hard compared with the introduction courses) I would like to ask for your help.

Columns to perform Gorard Index: Q1, Q2, Q3, Q4 Column to group by: Codgeo.

I've tried to do it by grouping or arranging, but I always get these errors.

> Gorard(Datos_muestrales_UBIGEO[,5:8]) %>%
+     arrange(Datos_muestrales_UBIGEO,Codgeo, .by_group = TRUE)
Error in UseMethod("arrange_") : 
  no applicable method for 'arrange_' applied to an object of class "c('double', 'numeric')"

> Gorard(Datos_muestrales_UBIGEO[,5:8]) %>%
+     group_by(Codgeo)
Error in UseMethod("group_by_") : 
  no applicable method for 'group_by_' applied to an object of class "c('double', 'numeric')"

Dataset can be found here

Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source