I am relatively new to r and I got the following problem, I hope you can help me with.
I have a table with a column RANDOM.s.
Another column shows the year. And a third column that represents some values or NA.
RANDOM <- sample(c("A","B","C","D"), size = 100, replace = TRUE)
Year <- sample(c(2008,2009,2010), 100, TRUE)
Value <- sample(c(0.22, NA), 100, TRUE)
I am looking for the following solution:
Year 2008 2009 2010 ...
Ticker
A 9 11 7
B 11 2 6
C
D
I want to get a table like this for example that gives me back, how often the Value in the Column "Value" appeared for the "RANDOM" in the year 2008.
So far I could only get a table that showed me how often I got the match
RANDOM and Year, but not the count of my third column. Like this:
Year 2008 2009 2010 ...
RANDOM
A 4 5 6
B
C
I would be really grateful if you could help me out on this.
Thank you! :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…