UPDATE: new function funN for calculations conditional to a certain number of valid observations. also started to implement documentation using roxygen2