0

I am counting the sum of words of strings with specific arguments e.g. for weeks (week 1 = 1, week 2 = 2 and so on) with the following command:

sum(data[which(data[,17]==1), 19])

[,17] is the column in the data frame of the numeric argument of the week which has to be 1 for week 1

, 19 is the column in the data frame of the number of words of each string

I have 31 weeks and 228.000 strings and I do not want to execute each command for each week seperately so I am searching for a function which can do it automatically for week 1-31 and gives me the results.

Thanks for helping!

s_baldur
  • 29,441
  • 4
  • 36
  • 69
  • can you make a reproducible example with with `dput(head(data, 15))` or similar? – s_baldur Nov 13 '18 at 09:23
  • Sorry but I do not know how these function can help me –  Nov 13 '18 at 09:38
  • Sharing data in your original post makes it much easier for other members to help you. See more info here: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example?rq=1 – s_baldur Nov 13 '18 at 09:48

0 Answers0