Hi Yosub,
Here is one way it can be done (assuming I got you right):
# invent data
set.seed(24)
tbl <- matrix(sample(c("", letters[1:4]), 20*8, replace = T), 20,8)
# getting the number of codes for all years:
table(c(tbl))
# getting the number of codes per year:
apply(tbl,2,table)
----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------
On Wed, Apr 20, 2011 at 6:05 AM, Yosub Jung <yosubjung@berkeley.edu>
wrote:
> Hello,
>
> I have a table that has 2000 rows and 8 columns. The headings of columns
> are: yearjel.code.1jel.code.2jel.code.3jel.code.4jel.code.5jel.code.6
> jel.code.7.
> Under each column, there are either numbers or blank spaces corresponding
> to
> the given year.
> For instance, my 10th row is:1019838242824382609170
> I want to count how many times each code appears in total and how many
> times
> it appears in each year.
> I don't think I can use table function. What can I do?
>
>
> Sincerely,
> Yosub Jung.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
[[alternative HTML version deleted]]