[R] Puzzled over "partial"
@kw@|mmo @end|ng |rom gm@||@com
Mon Jul 26 14:58:35 CEST 2021
First, your statement can be re-written as
since n - (n - p) is p. Second, you need to look at
And look at section "Arguments" subsection "partial", that should have the
details you're looking for. From what I understand, it guarantees that the
indices of "partial" will be sorted correctly, but all others won't, so
this saves time for things like "median". I hope this helps!
On Mon, Jul 26, 2021, 07:54 Nick Wray <nickmwray using gmail.com> wrote:
> Hello I am puzzled about the use or status of "partial" in R. years ago
> I found a little piece of code which gives the pth largest number in a
> n <- length(x)
> This works fine, although I have tried playing around with the code and
> don't understand what "partial" is doing here.
> However, wanted to work out what was going on, so I looked for "partial in
> r" on t'internet and got this site:Partial apply a function, filling in
> some arguments. — partial • purrr (tidyverse.org)
> # Partial is designed to replace the use of anonymous functions for #
> filling in function arguments. Instead of: compact1 <- function(x) discard
> <https://purrr.tidyverse.org/reference/keep.html>(x, is.null) # we can
> write: compact2 <- partial(discard, .p = is.null) # partial() works fine
> with functions that do non-standard # evaluation my_long_variable <- 1:10
> plot2 <- partial(plot, my_long_variable) plot2()
> when i tried to run the examples on this site I got error messages - R
> (studio) did not recognise the "partial" function here. The site did not
> say that I needed a particular package to run the "partial" function.
> Are there essentially two different things in R both described as "partial"
> but which are actually different entities?
> Thanks for any elucidation
> Nick Wray
> [[alternative HTML version deleted]]
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help