Displaying 20 results from an estimated 4000 matches similar to: "Row-wise recurive function call"
2016 Apr 22
1
Unique Ordering
Hi R-Help,
data at bottom
I've been struggling with a problem where I need to order based on 1) the
Frequency "Freq" and 2) keeping each group of 3 of the same type together
"Var2" but I want across all groups it to go "high to low" based on the
earn factor.
Thank you!
structure(list(Var1 = structure(c(1L, 3L, 2L, 1L, 2L, 3L, 1L,
3L, 2L, 3L, 1L, 2L, 3L, 1L,
2023 Jan 13
1
Customise Plot tick label on time series plot using date series
Hi,
I would like to customise my date series on the plot. I tried this:
dt_ts <- ts(dt)
autoplot(dt_ts[,2]) + ylab("Charge counts") + xlab("Daily")
but the label is not the date series.
Tqvm for any help given.
> dput(dt)
structure(list(time = c("1/1/2014", "2/1/2014", "3/1/2014", "4/1/2014",
"5/1/2014",
2023 Jan 13
1
Customise Plot tick label on time series plot using date series
?s 05:11 de 13/01/2023, roslinazairimah zakaria escreveu:
> Hi,
>
> I would like to customise my date series on the plot. I tried this:
>
> dt_ts <- ts(dt)
> autoplot(dt_ts[,2]) + ylab("Charge counts") + xlab("Daily")
>
> but the label is not the date series.
>
> Tqvm for any help given.
>
>
>> dput(dt)
> structure(list(time
2017 Dec 14
2
help with recursive function
Hi, I need some help with running a recursive function. I like to run funlp2 recursively.
When I try to run recursive function in another function named "calclp" I get this "Error: any(!dat2$norm_sd) >= 1 is not TRUE".
I have never built a recursive function before so having trouble executing it in this case. I would appreciate any help or guidance to resolve this issue.
2011 Jul 01
2
Initiating in BNArray
Hi,
I'm trying to understand some details about an example maintened in [1].
According that link, I have total.data as a data set (am I right?).
But I don't understand how is built that table.
I saved the dataset in a file, with dput(), and had something like this:
structure(list(df.all = structure(list(V1 = structure(c(1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,
2017 Dec 14
2
help with recursive function
My own typo ... whoops ...
!( any(dat2$norm_sd >= 1 ))
On Thu, Dec 14, 2017 at 3:43 PM, Eric Berger <ericjberger at gmail.com> wrote:
> You seem to have a typo at this expression (and some others like it)
>
> Namely, you write
>
> any(!dat2$norm_sd) >= 1
>
> when you possibly meant to write
>
> !( any(dat2$norm_sd) >= 1 )
>
> i.e. I think your !
2017 Dec 14
3
help with recursive function
If you are trying to understand why the "stopifnot" condition is met you
can replace it by something like:
if ( any(dat2$norm_sd >= 1) )
browser()
This will put you in a debugging session where you can examine your
variables, e.g.
> dat$norm_sd
HTH,
Eric
On Thu, Dec 14, 2017 at 5:33 PM, Eric Berger <ericjberger at gmail.com> wrote:
> The message is coming from
2017 Dec 14
2
help with recursive function
Hi, I accidently left out few lines of code from the calclp function. Updated function is pasted below.
I am still getting the same error ?Error: !(any(data1$norm_sd >= 1)) is not TRUE?
I would appreciate any help.
Nilesh
dput(calclp)
function (dataset)
{
dat1 <- funlp1(dataset)
recursive_funlp <- function(dataset = dat1, func = funlp2) {
dat2 <- dataset %>%
2017 Dec 14
0
help with recursive function
You seem to have a typo at this expression (and some others like it)
Namely, you write
any(!dat2$norm_sd) >= 1
when you possibly meant to write
!( any(dat2$norm_sd) >= 1 )
i.e. I think your ! seems to be in the wrong place.
HTH,
Eric
On Thu, Dec 14, 2017 at 3:26 PM, DIGHE, NILESH [AG/2362] <
nilesh.dighe at monsanto.com> wrote:
> Hi, I need some help with running a
2017 Dec 14
0
help with recursive function
Eric: I will try and see if I can figure out the issue by debugging as you suggested. I don?t know why my code after stopifnot is not getting executed where I like the code to run the funlp2 function when the if statement is TRUE but when it is false, I like it to keep running until the stopifnot condition is met.
When the stopifnot condition is met, I like to get the output from if statement
2017 Dec 14
0
help with recursive function
Eric: Thanks for taking time to look into my problem. Despite of making the change you suggested, I am still getting the same error. I am wondering if the logic I am using in the stopifnot and if functions is a problem.
I like the recursive function to stop whenever the norm_sd column has zero values that are above or equal to 1. Below is the calclp function after the changes you suggested.
2017 Dec 14
0
help with recursive function
The message is coming from your stopifnot() condition being met.
On Thu, Dec 14, 2017 at 5:31 PM, DIGHE, NILESH [AG/2362] <
nilesh.dighe at monsanto.com> wrote:
> Hi, I accidently left out few lines of code from the calclp function.
> Updated function is pasted below.
>
> I am still getting the same error ?Error: !(any(data1$norm_sd >= 1)) is
> not TRUE?
>
>
>
2017 Dec 14
1
help with recursive function
Your code contains the lines
stopifnot(!(any(data1$norm_sd >= 1)))
if (!(any(data1$norm_sd >= 1))) {
df1 <- dat1
return(df1)
}
stop() "throws an error", causing the current function and all functions in
the call
stack to abort and return nothing. It does not mean to stop now and return
a result.
Does the function give
2010 Feb 19
1
ggplot2 X axis levels
Hi all:
I've done this before with factors but can't figure how to do it with
a continuous variable. I am trying to reorder the sequence of my weeks
along the X axis. I want to start with week 27 to 52 and then 1 to 26.
I guess I could use levels along with seq() but doesn't seem to work for me.
Thanks for your help
winter <- structure(list(week = c(27L, 28L, 29L, 30L, 31L, 32L,
2012 Nov 14
2
aggrete data from combination
Dear R users,
A have a dataframe (matrix) with two collumns (plot, and diameter (d)). I
want all diameters values for different combination of plots.
For example I want all d values for all posible combination, 100C2 (all d
values for plot 1 with all d values in the plot 2.......with all d values
from plot 1 with all d values from plot 100, ...... with all d values from
plot 99 with all d values
2010 Aug 30
2
reordering levels error
Please consider the following dataset:
I want to reorder the levels by year but get the following error:
Error in tapply(v, x, FUN, ...) : arguments must have same length
?
I suspect that I need to add the levels before I melt the dataset
?but either way I have only use 'reorder' once before and can't figure
?out how it works..Thanks for any advice.
?
winter <- (list(week = c(26L,
2008 Jul 06
2
lattice question
I'm creating a lattice barchart based off a pretty complicated data
structure. The barchart comes out quite nice ( thanks
to lattice ) but the problem is that the horizontal axis comes out all
scrunched because the barchart doesn't know that the intervals
of Var.1 are really "associated" with the conditioning variable Var.2.
Therefore, all the intervals of Var.1 are put on
2008 Sep 26
2
Date Time conversion
what am I doing wrong?
chron(as.character(f), format=c(dates="%m/%d/%y", times="%h:%m"))
f <- structure(c(51L, 60L, 66L, 87L, 90L, 115L, 23L, 35L, 37L, 6L,
12L, 55L, 84L, 96L, 109L, 17L, 29L, 41L, 3L, 74L, 94L, 102L,
30L, 8L, 46L, 69L, 107L, 15L, 25L, 39L, 1L, 71L, 95L, 19L, 56L,
62L, 76L, 85L, 99L, 111L, 42L, 4L, 52L, 61L, 67L, 91L, 13L, 24L,
36L, 38L, 7L, 81L, 82L, 57L,
2010 May 10
1
cumsum output
Hi: Thanks to Dennis and Fernando for your help reordering the levels.
Now I have a different issue:
I am trying to get the?cumulative weekly values using cumsum and it
appears to output the wrong?values. Here's my dataset:
winter <-? structure(list(week = c(26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L,
34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L,
47L, 48L, 49L, 50L, 51L,
2009 Aug 07
1
ggplot2-ddply question
Hi all:
I am trying to use the ddply function to estimate the mean of 'Total','Fry','Smolt' and 'Fry.Eq' columns without success. I have the dput of my dataset below. I wonder if someone can give me a hand with this function.
# dput(winter)
winter <-structure(list(IDDate = structure(c(37L, 48L, 59L, 62L, 63L,
64L, 65L, 66L, 67L, 38L, 39L, 40L, 41L, 42L, 43L,