hi. i'd like to instantiate sed(1), send it some input, and retrieve
its output, all via pipes (rather than an intermediate file).
my sense from pipe and looking at the sources (sys-unix.c) is that is
not possible. is that true? are there any thoughts of providing such a
facility?
cheers, Greg
I am not sure if `pipe()` works for this, but if it turns out that it
does not, then you can use the processx package, e.g.:
> p <- processx::process$new("sed", c("-l", "s/a/x/g"), stdin = "|", stdout =
> "|")
> p$write_input("foobar\n")
> p$read_output()
[1] "foobxr\n"
The `-l` sed flag is to m
On Fri, 13 Mar 2020 20:26:43 +0300
Greg Minshall wrote:
> my sense from pipe and looking at the sources (sys-unix.c) is that is
> not possible. is that true? are there any thoughts of providing
> such a facility?
Pipes (including those created by popen(3), which R pipe() uses
internally) are u
On 13 March 2020 at 20:26, Greg Minshall wrote:
| hi. i'd like to instantiate sed(1), send it some input, and retrieve
| its output, all via pipes (rather than an intermediate file).
|
| my sense from pipe and looking at the sources (sys-unix.c) is that is
| not possible. is that true? are th
Well, if you want blocking, you can poll with an infinite timeout.
This returns if
1) there is output,
2) the process terminates, or
3) you interrupt with CTRL+C / ESC /etc.
and then right after the polling, you can read the output. This still
works if the process has finished already.
Gabor
On
FWIW if you're on unix, you can use named pipes (fifos) for that:
> system("mkfifo my.output")
> p = pipe("sed -l s:hello:oops: > my.output", "w")
> i = file("my.output", "r", blocking=FALSE, raw=TRUE)
> writeLines("hello!\n", p)
> flush(p)
> readLines(i, 1)
[1] "oops!"
Cheers,
Simon
> On 14/0
Dear R-devel,
There is a new feature in R-devel, which explicitly refers to LISP @
operator for splicing.
> The backquote function bquote() has a new argument splice to enable splicing
> a computed list of values into an expression, like ,@ in LISP's backquote.
Although the most upvoted SO ques
Hello,
Below is my code:
> A <- matrix(rnorm(10*3),ncol=3)
> b <- runif(10)
> reg <- lm(b ~ A)
> A1 <- matrix(rnorm(5*3),ncol=3)
> A1 <- as.data.frame(A1)
> b1 <- predict(reg,A1)
Warning message:
'newdata' had 5 rows but variables found have 10 rows
And instead of being an array of length 5, b1
The ":::" operator doesn't work for me with "Ecdat:::Crime" on
either macOS 10.15.3 or Windows 10.
A different but related issue is that "plm::Crime" says "Error:
'Crime' is not an exported object from 'namespace:plm'", even though
"library(plm); data(Crime); Crime" works. I woul
Hello,
The problem seems to be that A is a matrix. The following solves the error.
# create A and b as in your code then run
A <- as.data.frame(A)
df1 <- cbind(A, b)
reg <- lm(b ~ ., df1)
# etc
Hope this helps,
Rui Barradas
Às 04:36 de 17/03/20, Moshe Olshansky via R-devel escreveu:
Hello,
10 matches
Mail list logo