this is an anomonous function definition and .week is just the name of the
parameter I chose to use. As with any function definition, you can name the
parameters any way you want. In this case I have used the '.' to start the
name just to make it apparent that it is a parameter; personal style
Dear Jim,
I am confused by the function
function(.week)
Generally I have not figured it out yet and in particular, why are you
using "dot" week as in
.week
Is there any significance to the dot?
Thanks,
Bill
On Wed, Jan 22, 2014 at 10:48 PM, jim holtman wrote:
> function(.week)
[[alte
Here is the change to create a Sunday in a week if it does not exist.
I took out the Sunday (2009-11-01) for testing and you will notice
that week 201129 did not have a Sunday, so it has NaN as the result.
> x <- read.table(text = " Date nrec
+
+ 1 2011-07-17 667
+
+ 2 2011-07-18 266
+
+ 3
Hello Jim,
Thanks for this. I will study it. One thing, you wrote "# process each
week, substituting the mean if Sunday exists". Even if Sunday's data does
not exist, I need an entry for Sunday if Friday or Saturday (or both)
exist. I don't yet understand what you wrote so I am not sure if that is
Here's one way of doing it. Does not use "complicated" IFs; just
splits the data and works on it.
> x <- read.table(text = " Date nrec
+
+ 1 2011-07-17 667
+
+ 2 2011-07-18 266
+
+ 3 2009-10-29 29
+
+ 4 2009-10-30 211
+
+ 5 2009-10-31 237
+
+ 6 2009-11-01 898", header = TRUE, as.is =
Hello. I am trying to work out some complicated if() logic.
I thought of using which() and if() but cannot get it.
I have a dataframe that looks like this:
head(deleteFridayTest)
Date nrec
1 2011-07-17 667
2 2011-07-18 266
3 2009-10-29 29
4 2009-10-30 211
5 2009-10-31 237
6 2
6 matches
Mail list logo