inconsistency in list subsetting in R in linux

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

inconsistency in list subsetting in R in linux

akshay kulkarni
dear members,
                           I am using GNU R(R in linux CLI). I am trying to debug a function called "grand.finalelPf". In the function the following line appears

> yhpf2 <- mclapply(LYG2[-w], fun = forecast, h = 1)

I execute the above line in browse[2] prompt. I then type the following:
Browse[2] > length(yhpf2)

It also is getting executed with the following output:
[1] 464

But when I type this:
Browse[2] > yhpf2[[3]]

the ouput is this:

[1] "Error in lapply(X = S, FUN = FUN, ...) : \n  argument \"FUN\" is missing, with no default\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in lapply(X = S, FUN = FUN, ...): argument "FUN" is missing, with no default>
Browse[2] >

why is this getting outputted instead of a value? Even if all the yhpf's are NULL, the above is output is weird.

What is wrong? Why would the output relate to lapply? If the culprit was mclapply, then why does the line get executed without an error message? The same function is working perfectly well in windows(I used parLapply instead of mclapply).
Is this peculiar to R on Linux? Please help....

very many thanks for your time and effort,
Yours sincerely,
AKSHAY M KULKARNI


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: inconsistency in list subsetting in R in linux

R help mailing list-2
> args(parallel::mclapply)
function (X, FUN, ..., mc.preschedule = TRUE, mc.set.seed = TRUE,
    mc.silent = FALSE, mc.cores = 1L, mc.cleanup = TRUE, mc.allow.recursive
= TRUE)

You gave it 'fun=forecast' instead of 'FUN=forecast'.  Case matters in R.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Jun 29, 2018 at 4:19 AM, akshay kulkarni <[hidden email]>
wrote:

> dear members,
>                            I am using GNU R(R in linux CLI). I am trying
> to debug a function called "grand.finalelPf". In the function the following
> line appears
>
> > yhpf2 <- mclapply(LYG2[-w], fun = forecast, h = 1)
>
> I execute the above line in browse[2] prompt. I then type the following:
> Browse[2] > length(yhpf2)
>
> It also is getting executed with the following output:
> [1] 464
>
> But when I type this:
> Browse[2] > yhpf2[[3]]
>
> the ouput is this:
>
> [1] "Error in lapply(X = S, FUN = FUN, ...) : \n  argument \"FUN\" is
> missing, with no default\n"
> attr(,"class")
> [1] "try-error"
> attr(,"condition")
> <simpleError in lapply(X = S, FUN = FUN, ...): argument "FUN" is missing,
> with no default>
> Browse[2] >
>
> why is this getting outputted instead of a value? Even if all the yhpf's
> are NULL, the above is output is weird.
>
> What is wrong? Why would the output relate to lapply? If the culprit was
> mclapply, then why does the line get executed without an error message? The
> same function is working perfectly well in windows(I used parLapply instead
> of mclapply).
> Is this peculiar to R on Linux? Please help....
>
> very many thanks for your time and effort,
> Yours sincerely,
> AKSHAY M KULKARNI
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: inconsistency in list subsetting in R in linux

Jeff Newmiller
In reply to this post by akshay kulkarni
Read the Value section of ?mclapply. That error is an encapsulated error from the forecast function.

I suggest not debugging your code running in parallel... temporarily replace mclapply with lapply to debug so you can step into your worker fictions. You may also want to temporarily reduce the volume of data you are working with.

On June 29, 2018 4:19:40 AM PDT, akshay kulkarni <[hidden email]> wrote:

>dear members,
>I am using GNU R(R in linux CLI). I am trying to debug a function
>called "grand.finalelPf". In the function the following line appears
>
>> yhpf2 <- mclapply(LYG2[-w], fun = forecast, h = 1)
>
>I execute the above line in browse[2] prompt. I then type the
>following:
>Browse[2] > length(yhpf2)
>
>It also is getting executed with the following output:
>[1] 464
>
>But when I type this:
>Browse[2] > yhpf2[[3]]
>
>the ouput is this:
>
>[1] "Error in lapply(X = S, FUN = FUN, ...) : \n  argument \"FUN\" is
>missing, with no default\n"
>attr(,"class")
>[1] "try-error"
>attr(,"condition")
><simpleError in lapply(X = S, FUN = FUN, ...): argument "FUN" is
>missing, with no default>
>Browse[2] >
>
>why is this getting outputted instead of a value? Even if all the
>yhpf's are NULL, the above is output is weird.
>
>What is wrong? Why would the output relate to lapply? If the culprit
>was mclapply, then why does the line get executed without an error
>message? The same function is working perfectly well in windows(I used
>parLapply instead of mclapply).
>Is this peculiar to R on Linux? Please help....
>
>very many thanks for your time and effort,
>Yours sincerely,
>AKSHAY M KULKARNI
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.