I'm trying to use "sink" in a function in order to export my data in a text file but I'm struggling: I get an error message saying "argument "filename" is missing, with no default".
Could you help me? :)
That's my function:
Fonction_desc <- function(var_interest, g, titre, filename, myfun){
tab <- cbind("mean"= tapply(var_interest, g, mean),
"sd"= tapply(var_interest, g, sd),
"min"= tapply(var_interest, g, min),
"max"= tapply(var_interest, g, max),
cat("====================================================================\n"))
cat("Statistiques par mois de la variable température\n")
cat("--------------------------------------------------------------------\n")
print(round(tab, digits = 2))
sink(filename)
sink()
tab
}
Fonction_desc(meteo_charleroi$T, meteo_charleroi$date1, meteo_charleroi)
Kind regards :)