View source: R/CleanColumnNames.R
modify_loop_column_names | R Documentation |
A function to modify column names for RHoMIS loops
modify_loop_column_names(column_names, loop_type)
column_names |
A list of the column names which need to be shortened. This would generally be all of the column names of the RHoMIS dataset. |
loop_type |
What loop_type of loop is concerned, this could include options such as "crop_repeat", "livestock_repeat", "offfarm_income_repeat". It is very important that this "type" matches the pattern in the original column names |
The RHoMIS survey is structured using a series of important loops. These are often labelled: "xxxx/crop_repeat[1]/crop_name", "xxxx/crop_repeat[2]/crop_name", "xxxx/crop_repeat[3]/crop_name"...
This function aims to modify those into a more user-friendly format: "crop_name_1", "crop_name_2", "crop_name_3" ...
Rpackage file: CleanColumnNames.R
A list of column names which need to be modified
original_columns <- c(
"x/non_repeat_column",
"xxxx/crop_repeat[1]/crop_name",
"xxxx/crop_repeat[2]/crop_name"
)
loop_type <- "crop_repeat"
modified_names <- modify_loop_column_names(original_columns, loop_type)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.