You can also use 'embed' to create a list of indices you can use to do the test:
> dat
dsc1 c2
1 2010-04-03 100 0
2 2010-04-30 11141 15
3 2010-05-01 3 16
4 2010-05-02 7615 14
5 2010-05-03 6910 17
6 2010-05-04 5035 3
7 2010-05-05 3007 15
8 2010-05-06 4 14
9 2
Hi all,
zoo::rollmean() is a nice idea. But if I understand Mike correctly, he
wants 5 out of any 7 consecutive logicals to be TRUE, where these 5 do
not necessarily need to be consecutive themselves. (remaining open
question: could, e.g., the condition on c1 be TRUE for rows 1,2,3,4,5
and on
Hi Michael,
The days in your example do not look continuous (at least from my
thinking), so you may have extra requirements in mind, but take a look
at this code. My general thought was first to turn each column into a
logical vector (c1 >= 100 and c2 >= 8). Taking advantage of the fact
that R t
Sorry for not being clear.
In the dataset there are around 100 or so days of data (in the case also rows
of data)
I need to make sure that the person meets that c1 is at least 100 AND c2 is at
least 8 for 5 of 7 continuous days.
I will play with what I have and see if I can find out how to do
Mike,
I am slightly unclear on what you want to do. Do you want to check rows
1 and 7 or 1 *to* 7? Should c1 be at least 100 for *any one* or *all*
rows you are looking at, and same for c2?
You can sort your data like this:
data <- data[order(data$ds),]
Type ?order for help. But also do this
Michael,
This will get you started. What you are doing with the seven rows isn't
clear
from your description. I made the dates into "Date" objects. I called your
data
"mydata" as "data" is potentially ambiguous.
Rich
mydata <- read.table(header=TRUE, textConnection("
ds c1 c2
1 2
Hello R users,
I am a researcher at the University of Michigan looking for a solution to an R
problem. I have loaded my data in from a mysql database and it looks like this
> data
ds c1 c2
1 2010-04-03100 0
2 2010-04-30 11141 15
3 2010-05-01 3
On Sat, 2007-09-15 at 12:11 -0400, Letticia Ramlal wrote:
> Hello
> I was wonderinf if anyone can help me with this problem, it seems
> trivial but for some reason I can not figure it out.
>
> With a single R command complete the following:
> create a vector calles seqvec that repeats the sequen
On Sat, 2007-09-15 at 12:11 -0400, Letticia Ramlal wrote:
> Hello
> I was wonderinf if anyone can help me with this problem, it seems trivial but
> for some reason I can not figure it out.
>
> With a single R command complete the following:
> create a vector calles seqvec that repeats the seque
Hello
I was wonderinf if anyone can help me with this problem, it seems trivial but
for some reason I can not figure it out.
With a single R command complete the following:
create a vector calles seqvec that repeats the sequence 1, 3,6, 10,15,21.( I
was trying to use c() but this does not work
10 matches
Mail list logo