In my R script I print different variables and functions. The script is getting a bit more complex so I started to enclose the code in conditions. So far so good but now in the console prints out only the last variable or function within the condition. It looks like in R a condition is working somehow as a function that only returns the value of the last statement. In the following example only «b» is printed out but I expected to see «a» and «b».
somevariable <- TRUE
if (somevariable) {
a <- 'a‘;
a
b <- 'b‘;
b
}
Is there a way to print both including the statement itself?
Aucun commentaire:
Enregistrer un commentaire