Hello-
I have some code that looks like this:
with(mydatalocal, sum(table(Service[Time==5:8])))
This is designed to add up the numbers of responses between the Time
codes 5 to 8 (which are integers and refer to quarters). Service is
just one of the variables, I'm just trying to count the number
What you are probably looking for is the %in% operator:
with(mydata, sum(table(X1[X2 %in% 5:8])))
Read up on how operations are vectorized and how variables are
recycled if not long enough
x - 1:10
x == 1:2 # compares first two fine
[1] TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
2 matches
Mail list logo