Why doesn’t this function:
test <- function(somebool = FALSE) {
mydata<-read.csv("mycsvfile.csv")
if(somebool){
print("somebool")
summary(mydata)
}
mydata
}
outdata<-test(somebool=TRUE)
print("head")
head(outdata)
print the summary within the function call? it does print the “somebool” just before it, but not the summary.
Thanks a lot for your help.
You’re calling the function
summarybut not printing the result. Just change it to: