Hi Ahson,
Guessing what your data frame might look like, here are two easy ways:
All_companies<-data.frame(year=c(1970:2015,2000:2015,2010:2015),
COMPANY_NUMBER=c(rep(1,46),rep(2,16),rep(3,6)),
COMPANY_NAME=c(rep("IBM",46),rep("AMAZON",16),rep("SPACE-X",6)))
# easy ways
table(All_companies$COMPA
What you are asking is one area where the package data.table really
shines. You didn't provide an example, but based on your question you
would do something like:
library(data.table)
dt <- as.data.table(All_companies)
dt[, .N, by=COMPANY_NAME]
You will have to read up on data.table, but .N gives
It occurs to me a simple table command will do what you say you want but I
suspect the real analysis is more complicated
dat1 <- data.frame(aa = sample(letters[1:5], 10, replace = TRUE),
bb = 1:10)
table(dat1$aa)
On Tue, 21 Jul 2020 at 14:01, John Kane wrote:
> As Bert says th
As Bert says that does not look like R
Have a look an these links for some suggestions on asking questions here.
http://adv-r.had.co.nz/Reproducibility.html
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
On Tue, 21 Jul 2020 at 13:42, Bert Gunter wrote:
What language are you programming in? -- it certainly isn't R.
I suggest that you stop what you're doing and go through an R tutorial or
two before proceeding. This list cannot serve as a substitute for doing
such homework (is this homework, btw? -- that's off topic here) nor can we
provide such t
5 matches
Mail list logo