Skip to content

Arrange data

1 message · Jim Lemon

#
Your problem is in the subset operation. You have asked for a value of
month greater or equal to 7 and less than or equal to 6. You probably
got an error message that told you that the data were of length zero
or something similar. If you check the result of that statement:
logical(0)

In other words, the two logical statements when ANDed cannot produce a
result. A number cannot be greater than or equal to 7 AND less than or
equal to 6. What you want is:

mddat2<-mddat[mddat$Year == 1975 & mddat$Month >= 7 |
 mddat$Year == 1976 & mddat$Month <= 6,]
mean(mddat2$Value)
[1] 88.91667

Apart from that, your email client is inserting EOL characters that
cause an error when pasted into R.

Error: unexpected input in "?"

Probably due to MS Outlook, this has been happening quite a bit lately.

Jim

On Mon, Aug 3, 2020 at 11:30 PM Md. Moyazzem Hossain
<hossainmm at juniv.edu> wrote: