--- title: "The FSS package - use case number 1" author: Sebastian Neuenfeldt date: "`r format(Sys.time(), '%d %B %Y')`" output: word_document: reference_docx: "D:/public/neuenfeldt/MIND_STEP/git/MIND STEP - kind of template.docx" --- # The FSS package The goal of the FSS package is to provide some functions to analyse (German) Farm Structure Survey (FSS) data. ## Installation You can install the GitLab version of FSS from [GitLab](https://git-dmz.thuenen.de/neuenfeldt/fss) with: ``` {r} # devtools::install_git("https://git-dmz.thuenen.de/neuenfeldt/fss") --> ``` ## Example ### Load FSS package ```{r} library(FSS) ``` ### Test a function Here we will test one of the provided functions: `generateFakeFSSData_DE()`. We generate some basic variables, which are automatically produced. We set an additional variable to be generated, namely C0300. The variable will be a continuous variable. ```{r} FSS_data_DE <- generateFakeFSSData_DE(C0codes = "C0300") ``` ### Add a specific categorical variable No we will add a specific variable, i.e. a categorical variable if a farm is an organic farm. This will be randomly distributed. The probability of a farm to be organic is 20%. ```{r, message=FALSE} library(tidyverse) FSS_data_DE <- FSS_data_DE %>% mutate(C0501=sample(c(0,1), size = nrow(FSS_data_DE), replace = TRUE, prob = c(0.8,0.2))) ``` ### Some analysis After that we analyse the data regarding the number of farms that are organic (C0501) for each year (C0008U1) and farm type (C0060UG1). ```{r} FSS_data_DE %>% group_by(C0008U1,C0060UG1,C0501) %>% count() %>% pivot_wider(names_from = C0060UG1, values_from = n) %>% knitr::kable() ``` ## Conclusion This could be the final output of an overview of conventional (C0501=0) and organic (C0501=1) farms for each year and the provided farm types. As this is a fake data set, these numbers make no sense.