and subsequent arguments match up to.
-Original Message-
From: R-help On Behalf Of Richard O'Keefe
Sent: Wednesday, January 4, 2023 1:56 AM
To: Milan Glacier
Cc: R-help Mailing List
Subject: Re: [R] Pipe operator
This is both true and misleading.
The shell pipe operation came from fu
Maybe I missed it in the whole discussion, but since R 4.2.0 the base R
pipe operator also has a placeholder '_' to specify where the result of
the left-hand side should be used in the right-hand side (see
https://stat.ethz.ch/pipermail/r-announce/2022/000683.html).
So the only dif
This is both true and misleading.
The shell pipe operation came from functional
programming. In fact the shell pipe operation
is NOT "flip apply", which is what |> is, but
it is functional composition. That is
out = let out = command
cmd1 | cmd2 = \x.cmd2(cmd1(x)).
Pragmatically, the Unix shell
With 50 years of programming experience, just think about how useful
pipe operator is in shell scripting. The output of previous call becomes
the input of next call... Genious idea from our beloved unix
conversion...
On 01/03/23 16:48, Sorkin, John wrote:
I am trying to understand the reason fo
t is part of base R. As far
> as I know it does the same thing as %>%, or at my level of programing I
> have not encountered a difference.
>
> Tim
>
> -Original Message-
> From: R-help On Behalf Of Sorkin, John
> Sent: Tuesday, January 3, 2023 11:49 AM
> To:
s complex in situations
like this. Just use a simple assignment pre or post as meets your needs.
-Original Message-
From: Boris Steipe
Sent: Tuesday, January 3, 2023 2:01 PM
To: R-help Mailing List
Cc: avi.e.gr...@gmail.com
Subject: Re: [R] Pipe operator
Working off Avi's example -
The simplest and best answer is "fashion".
In FSharp,
> (|>);;
val it: ('a -> ('a -> 'b) -> 'b)
The ability to turn f x y into y |> f x
makes perfect sense in a programming language
where Currying (representing a function of n
arguments as a function of 1 argument that
returns a function of n-1 arg
Jeff,
Thank you for contributing important information to this thread.
From: Jeff Newmiller
Sent: Tuesday, January 3, 2023 2:07 PM
To: r-help@r-project.org; Sorkin, John; Ebert,Timothy Aaron; 'R-help Mailing
List'
Subject: Re: [R] Pipe ope
> R is a functional language, hence the pipe operator is not needed.
Not factual... just opinion. Please be conscious of your biases and preface
opinion with a disclaimer.
I heard identical complaints from embedded assembly language programmers when C
became all the rage... "don't need another
R is a functional language, hence the pipe operator is not needed.
Also it makes the code unreadable as it is less obvious how a call stack
looks like and what the arguments to the function calls are.
It is relevant for a shell for piping text streams.
If people cannot live without the pipe op
Dear John,
some more experienced users might give you a different and more helpful
answer, but I was not really convinced by the pipe operator until I
tried it out, for the same reasons as you.
In my opinion, the pipe operator is there only to improve the
readability of your code. Think abou
need to care.
-Original Message-
From: R-help On Behalf Of Sorkin, John
Sent: Tuesday, January 3, 2023 11:49 AM
To: 'R-help Mailing List'
Subject: [R] Pipe operator
I am trying to understand the reason for existence of the pipe operator,
%>%, and when one should use it
Às 19:14 de 03/01/2023, Rui Barradas escreveu:
Às 17:35 de 03/01/2023, Greg Snow escreveu:
To expand a little on Christopher's answer.
The short answer is that having the different syntaxes can lead to
more readable code (when used properly).
Note that there are now 2 different (but somewhat s
retains only selected rows and pipe that
>> to a function that drops some of the columns and pipe that to a function
>> that groups the items or sorts them and pipe that to a function that does a
>> join with another object or generates a report or so many other things.
>>
>
Às 17:35 de 03/01/2023, Greg Snow escreveu:
To expand a little on Christopher's answer.
The short answer is that having the different syntaxes can lead to
more readable code (when used properly).
Note that there are now 2 different (but somewhat similar) pipes
available in R (there could be mor
vel of programing I have not
>encountered a difference.
>
>Tim
>
>-Original Message-
>From: R-help On Behalf Of Sorkin, John
>Sent: Tuesday, January 3, 2023 11:49 AM
>To: 'R-help Mailing List'
>Subject: [R] Pipe operator
>
>[External Email]
>
&g
generates a report or so many other things.
>
> So the real answer is that piping is another WAY of doing things from a
> programmers perspective. Underneath it all, it is mostly syntactic sugar and
> the interpreter rearranges your code and performs the steps in what seems
> like a diffe
Message-
From: R-help On Behalf Of Ebert,Timothy Aaron
Sent: Tuesday, January 3, 2023 12:08 PM
To: Sorkin, John ; 'R-help Mailing List'
Subject: Re: [R] Pipe operator
The pipe shortens code and results in fewer variables because you do not
have to save intermediate steps. Once yo
-Original Message-
From: R-help On Behalf Of Sorkin, John
Sent: Tuesday, January 3, 2023 11:49 AM
To: 'R-help Mailing List'
Subject: [R] Pipe operator
I am trying to understand the reason for existence of the pipe operator,
%>%, and when one should use it. It is my underst
To expand a little on Christopher's answer.
The short answer is that having the different syntaxes can lead to
more readable code (when used properly).
Note that there are now 2 different (but somewhat similar) pipes
available in R (there could be more in some package(s) that I don't
know about,
ntered a
difference.
Tim
-Original Message-
From: R-help On Behalf Of Sorkin, John
Sent: Tuesday, January 3, 2023 11:49 AM
To: 'R-help Mailing List'
Subject: [R] Pipe operator
[External Email]
I am trying to understand the reason for existence of the pipe operator, %>
ence.
Tim
-Original Message-
From: R-help On Behalf Of Sorkin, John
Sent: Tuesday, January 3, 2023 11:49 AM
To: 'R-help Mailing List'
Subject: [R] Pipe operator
[External Email]
I am trying to understand the reason for existence of the pipe operator, %>%,
and when one should u
I have not encountered a
difference.
Tim
-Original Message-
From: R-help On Behalf Of Sorkin, John
Sent: Tuesday, January 3, 2023 11:49 AM
To: 'R-help Mailing List'
Subject: [R] Pipe operator
[External Email]
I am trying to understand the reason for existence of the pipe ope
I am trying to understand the reason for existence of the pipe operator, %>%,
and when one should use it. It is my understanding that the operator sends the
file to the left of the operator to the function immediately to the right of
the operator:
c(1:10) %>% mean results in a value of 5.5 whic
On 22/05/2021 8:26 p.m., Jeff Newmiller wrote:
What is the precedence of the new |> pipe operator? I don't see it mentioned in
?Syntax, nor does it come up when I search the R Language Definition document.
It's the same precedence as the %any% operators listed in the ?Syntax
table, so it mat
R 4.1.0 was released this week with a new pipe operator and a new anonymous
function shorthand (\(x) x^2).
The pipe operator is not quite as flexible as the magrittr pipe, but it is
faster (not that the magrittr pipe is noticably slow) and built-in.
On May 22, 2021 8:07:27 PM PDT, Caitlin Gibbo
This is part of the R-4.1.0 release which came out a few days ago.
See
1. https://stat.ethz.ch/pipermail/r-announce/2021/000670.html
2.
https://www.jumpingrivers.com/blog/new-features-r410-pipe-anonymous-functions/
3.
https://community.rstudio.com/t/psa-r-4-1-0-release-requires-rstudio-preview/1052
I didn’t know R had a new pipe operator, but I have seen “|>” (without quotes)
used in the Elixir language though. Are there now two? “%>%” from the magrittr
package and “|>” which is built-in?
> On May 22, 2021, at 5:26 PM, Jeff Newmiller wrote:
>
> What is the precedence of the new |> pipe
What is the precedence of the new |> pipe operator? I don't see it mentioned in
?Syntax, nor does it come up when I search the R Language Definition document.
--
Sent from my phone. Please excuse my brevity.
__
R-help@r-project.org mailing list -- To U
;dir") for details.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of nalluri pratap
> Sent: Thursday, April 04, 2013 7:57 AM
> To: r-help@r-project.
Hi,
In SAS I have something like
%let dirname = c:\work\raw_data_files;
filename DIRLIST pipe "dir /B &dirname\*.txt";
Can someone help me to convert this to R. I tried with system and pipe, but It
actually creates a file on the disk which I don't like. I just need to have a
reference to th
Thanks for the info. I'll give that a try.
On May 25, 2010, at 5:36 PM, jim holtman wrote:
readLines will read until it reached an end-of -file. try
readLines(con, n=1)
to read one line at a time an then process it.
On Tue, May 25, 2010 at 2:07 PM, Joe Stuart
wrote:
Hi,
I'm trying to
readLines will read until it reached an end-of -file. try
readLines(con, n=1)
to read one line at a time an then process it.
On Tue, May 25, 2010 at 2:07 PM, Joe Stuart wrote:
> Hi,
> I'm trying to use the pipe function to read data from another process
> on my server.
>
> Here is the code I h
Hi,
I'm trying to use the pipe function to read data from another process
on my server.
Here is the code I have tried.
con <- pipe("/var/matlab/scripts/stream.pl")
while(con_read <- readLines(con)) {
print(con_read)
}
Problem is that the data from the perl script just keeps appending to
con_re
robbert blonk wrote:
Sorry, forgot to included the information.
Working in Windows (although a try on linux gave the same problems)
R 2.10.0
Do you suggest to update a newer version of R?
I don't think there were any changes to the system() code between 2.10.0
and 2.10.1, but there are d
Sorry, forgot to included the information.
Working in Windows (although a try on linux gave the same problems)
R 2.10.0
Do you suggest to update a newer version of R?
regards,
Robbert
--
View this message in context:
http://n4.nabble.com/Pipe-shell-R-does-not-wait-tp1458692p1458727.html
Sent
robbert blonk wrote:
Dear All,
Within a large script, I try to invoke a second program (called e.g. XXX)
from R using "shell" or "pipe".
e.g.:
readLines(pipe("XXX"))
or:
shell("XXX",intern=TRUE, wait = TRUE)
After running the program, the script reads a file with solutions
Dear All,
Within a large script, I try to invoke a second program (called e.g. XXX)
from R using "shell" or "pipe".
e.g.:
> readLines(pipe("XXX"))
or:
> shell("XXX",intern=TRUE, wait = TRUE)
After running the program, the script reads a file with solutions produced
by the second program ("XX
Yes, that's exactly what I am after. Thank you for clarifying my problem for me!
I'll try to dive into the plot.performance function.
Best,
Tim
>>> Tobias Sing 9/24/2009 9:57 AM >>>
Tim,
if I understand correctly, you are trying to get the numerical values
of averaged cross-validation curves.
David,
Thank you for your reply. Yes, I can access the y-values slot with p...@y-values
but, note that in the cross-validation example (ROCR.xval), the plot function
averages across the list of ten vectors in the y-values slot.
I might be able to create a function to average across these ten ve
Tim,
if I understand correctly, you are trying to get the numerical values
of averaged cross-validation curves.
Unfortunately the plot function of ROCR does not return anything in
the current version (it's a good suggestion to change this).
If you want a quick fix, you could change the plot.perfo
On Sep 24, 2009, at 9:09 AM, Tim Howard wrote:
All,
I'm trying again with a slightly more generic version of my first
question. I can extract the
plotted values from hist(), boxplot(), and even plot.randomForest().
Observe:
# get some data
dat <- rnorm(100)
# grab histogram data
hdat <- h
Whoops, sorry. Here is the full set with the missing lines:
library(ROCR)
data(ROCR.xval)
pred <- prediction(ROCR.xval$predictions, ROCR.xval$labels)
perf <- performance(pred,"tpr","fpr")
RCdat <- plot(perf, avg="threshold")
RCdat
Thanks.
Tim
>>> David Winsemius 9/24/2009 9:25 AM >>>
On Sep 24,
On Sep 24, 2009, at 9:09 AM, Tim Howard wrote:
All,
I'm trying again with a slightly more generic version of my first
question. I can extract the
plotted values from hist(), boxplot(), and even plot.randomForest().
Observe:
# get some data
dat <- rnorm(100)
# grab histogram data
hdat <- h
All,
I'm trying again with a slightly more generic version of my first question. I
can extract the
plotted values from hist(), boxplot(), and even plot.randomForest(). Observe:
# get some data
dat <- rnorm(100)
# grab histogram data
hdat <- hist(dat)
hdat #provides details of the hist outp
Hi all,
Usually when I do a command in shell and have the output read from R, I
like to do this:
pp <- pipe(cmd)
sol <- scan(pp, what="character", sep="\n")
I prefer this one over read.table since read.table somewhere has a gc
call and it's slow.
However, sometim
46 matches
Mail list logo