Skip to contents

Presuming that orgdata package has been installed, this is how you can start using the most important functions.

Aggregate all files

To aggregate all files under a specific group such as BEFOLKNING group.

library(orgdata)
df <- make_file("BEFOLKNING")
df

If you are satisfy with the output and no error is shown during the process, you could save the output ie, object df above, as a .csv file with:

save_file(df, "BEFOLKNING")

If you are certain that the process has been controlled before and everything should be working correctly. You could save the output directly as a .csv file when running make_file() function with argument save = TRUE:

df <- make_file("BEFOLKNING", save = TRUE)

It is advisable to mark the file as KONTROLLERT in the Access Database under table for original files when you have checked the output. This will ensure shorter processing time when you re-run make_file() because it will skip all the cleaning and recording processes. This is because they are already saved in the data warehouse. The data warehouse can be found in ../PRODUKSJON/STYRING/raw-khelse/org_database

Aggregate selected files only

Aggregating the whole files in a group could take a long time when there are many files in the selected group. You could select only specific file or files by selecting the KOBLID instead. The example below is for selecting one or few files respectively.

df <- make_file("BEFOLKNING", koblid = 4)
df <- make_file("BEFOLKNING", c(4,10,15))

Process files without aggregating

When there is a need to look at the file prior to aggregating it. You could specify argument aggregate as FALSE. The same behavior could also be achieved by activating it globally via options.

df <- make_file("BEFOLKNING", aggregate = FALSE)

# Global option
options(orgdata.aggregate = FALSE)
df <- make_file("BEFOLKNING")

By activating it globally using options, all proceeding processes will not be aggregated unless it’s changed during function call ie. include argument aggregate = TRUE, or you reset the global options with: