innerFun <- function(i, df) { if (i == 1) mean(df[[i]]) else median(df[[i]]) } sapply(1:length(myDf), innerFun, df=myDf) Not as efficient as apply for larger data structures I'd imagine, since you'r
Here's a another approach using approx. If you want to consider slightly different values of 'ratio' to be equal, then modify the comparison yleft==yright appropriately. method="constant", f=0)$y met
I suspect one problem you are having is that you might be confusing the contents of the string with the way it is printed out. E.g., consider this example: [1] "\001\240" [1] 2 [1] 1 160 Note that th
Here's a collection of notes on commands for manipulating tabbed graphsheets under Windows. The first three functions in this list are what you need to cycle through the pages in a tabbed graphsheet.
Just pass the additional arguments as extra arguments to nlminb: $parameters: [1] -1 $objective: [1] 0 $parameters: [1] -2.000001 $objective: [1] -3 Unfortunately, this is not documented correctly in
I noticed that timeAlign() seems broken in S-PLUS 7.0: when given dir=-1, it aligns some days that are the 31st of a month to the next day. S-PLUS 6.X does not have this problem. E.g.: in.format="[%m
[snip] However, lapply uses for loops, so you might as well use the for loops explicitly (or try R). Actually, while that is true in R, I believe it is not true in S-PLUS: in S-PLUS lapply() calls t
I noted that your question had already been answered, but it's also worth pointing out once in a while that it is not a good idea to use the underscore "_" as an assignment operator (use "<-" instead