[R] sequence of commands in R

Don MacQueen macq at llnl.gov
Mon Nov 30 01:05:34 CET 2009


You don't see the standard deviations because 
only the final result (the output of summary() in 
your case) is output by the function, not the 
intermediate results (the results of the apply() 
function in your case).

Try this:

resumen<-function(x) {
	print( apply(x,2,sd,na.rm=TRUE))
	summary(x)
	}

-Don

At 9:17 PM +0100 11/29/09, Manuel Jesús López Rodríguez wrote:
>Dear all,
>I would like to know how could I execute a 
>sequence or orders with just a function, i.e, 
>that just typing the function name, R gives me 
>all the parameters I want (for instance, if I 
>want to see the summary, the standard deviation, 
>the number of valid cases, etc of a dataframe 
>just with one function). I have tried with the 
>following, but just compute the second argument 
>of the body, i.e., the summary:
>
>resumen<-function(x) {
>	apply(x,2,sd,na.rm=TRUE)
>	summary(x)
>	}
>
>Thank you very much for your help!!
>
>Manuel
>
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://*stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.


-- 
---------------------------------
Don MacQueen
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
macq at llnl.gov




More information about the R-help mailing list