Regex R提取中的输出

Regex R提取中的输出,regex,r,output,Regex,R,Output,作为函数的一部分,R返回 [1] Provided that the data is normally: time series estimate = 5478908.4 with confidence interval (4779426,6282453.9) 我只需要把这些数字放到一个矩阵中 5478908 4779426 6282453 有没有一种方法可以对输出执行此操作 通过负回溯 > x <- 'Provided that the data is normally: ti

作为函数的一部分,R返回

[1] Provided that the data is normally: time series estimate = 5478908.4 with confidence interval (4779426,6282453.9)
我只需要把这些数字放到一个矩阵中

5478908 4779426 6282453

有没有一种方法可以对输出执行此操作

通过负回溯

> x <- 'Provided that the data is normally: time series estimate = 5478908.4 with confidence interval (4779426,6282453.9)'
> regmatches(x, gregexpr("(?<!\\d\\.)\\d+", x, perl=T))[[1]]
[1] "5478908" "4779426" "6282453"

或者是一个可复制的例子?或者,strsplitx,\\.\\d+\\d+,perl=T,但这也会产生空字符串。我认为OP没有x。我猜他需要capture.output。@Davi就是这样是的……我不知道capute output怎么可能做到这一点?是的,只需要提到capture.output而不是x。。不工作?但是studff是由函数输出的…我应该在哪里调用capute.output?在你的情况下它是如何工作的?