[R] result

水静流深 1248283536 at qq.com
Tue Dec 17 07:50:21 CET 2013


Mydata is as under.
dat="  salary   ex
+ 1   1856 1799
+ 2   1856 1800
+ 3   1858 1800
+ 4   1858 1801
+ 5   1862 1803
+ 6   1862 1805
+ 7   1862 1810
+ 8   1865 1805
+ 9   1865 1808
+ 10  1865 1815
+ 11  1865 1820
+ 12  1870 1810
+ 13  1870 1830
+ 14  1880 1840
+ 15  1880 1845
+ 16  1880 1851
+ 17  1880 1853
+ 18  1880 1855
+ 19  1885 1850
+ 20  1885 1852
+ 21  1885 1857
+ 22  1885 1860
+ 23  1898 1855
+ 24  1898 1858
+ 25  1898 1861
+ 26  1898 1863
+ 27  1898 1866
+ 28  1898 1867
+ 29  1898 1890
+ 30  1902 1850
+ 31  1902 1853
+ 32  1902 1869
+ 33  1902 1872
+ 34  1902 1873
+ 35  1915 1850
+ 36  1915 1859
+ 37  1915 1863
+ 38  1915 1868
+ 39  1915 1875
+ 40  1915 1898
+ "
 
data<-read.table(text=dat,header=TRUE)
 
I want to get the result(please see the attatchment),the header is salary,the rownames is ex.
I only can get the "total column"
rev(table(cut(data[,2],breaks=seq(1795,1905,10),right=F))) 

How can I get the other data  by some code,not by hand?


More information about the R-help mailing list