[R] Summaries

Adaikalavan RAMASAMY ramasamya at gis.a-star.edu.sg
Thu Dec 18 14:45:36 CET 2003


If your dataset contains integer or limited possible unique numbers only I find the following more concise. 
 
m <- matrix( rpois(60, 5), nc=6 )
apply( m , 2, function(x) table( factor(x, levels=0:max(m))) )

If your dataset has continous or lots of unique numbers you may wish to consider only the summary statistics. You can try the function stats() or graphically bplot() [both from library fields]
 
Regards, Adai.
 
 

	-----Original Message----- 
	From: r-help-bounces at stat.math.ethz.ch on behalf of Eric Lecoutre 
	Sent: Thu 18/12/2003 16:22 
	To: Perez Martin, Agustin; lista R help (E-mail) 
	Cc: 
	Subject: Re: [R] Summaries
	
	


	Have a look at 'table'
	To compute for all columns of your dataset, combine with 'apply':
	
	 > data(iris)
	 > apply(iris,2,table)
	
	[...]
	
	$Petal.Width
	
	0.1 0.2 0.3 0.4 0.5 0.6 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2
	2.3 2.4 2.5
	   5  29   7   7   1   1   7   3   5  13   8  12   4   2  12   5   6   6
	3   8   3   3
	
	$Species
	
	     setosa versicolor  virginica
	         50         50         50
	
	
	Eric
	
	
	At 09:18 18/12/2003, Perez Martin, Agustin wrote:
	>Hello UseRs:
	>
	>Excuses for my english.
	>I have a dataset with 65000 records and I'd like to make a summary where I
	>can view all the values (with the number of times that it repeats) that
	>there are each column of my dataset.
	>I tried with summary( ), str( ), but nothing gives me the result that I am
	>loking for.
	>
	>Thank you very much.
	>
	>______________________________________________
	>R-help at stat.math.ethz.ch mailing list
	>https://www.stat.math.ethz.ch/mailman/listinfo/r-help <https://www.stat.math.ethz.ch/mailman/listinfo/r-help> 
	
	
	
	--------------------------------------------------
	L'erreur est certes humaine, mais un vrai désastre
	nécessite un ou deux ordinateurs. Citation anonyme
	--------------------------------------------------
	Eric Lecoutre
	Informaticien/Statisticien
	Institut de Statistique / UCL
	
	TEL (+32)(0)10473050       lecoutre at stat.ucl.ac.be
	URL http://www.stat.ucl.ac.be/ISpersonnel/lecoutre <http://www.stat.ucl.ac.be/ISpersonnel/lecoutre> 
	
	______________________________________________
	R-help at stat.math.ethz.ch mailing list
	https://www.stat.math.ethz.ch/mailman/listinfo/r-help <https://www.stat.math.ethz.ch/mailman/listinfo/r-help>




More information about the R-help mailing list