Questions tagged [sink]

Command in the programming language R. Sends R Output to a connection.

Command in the R programming language. Sends R Output to a connection.

Related tags:

187 questions
40
votes
2 answers

is it possible to redirect console output to a variable?

In R, I'm wondering if it's possible to temporarily redirect the output of the console to a variable? p.s. There are a few examples on the web on how to use sink() to redirect the output into a filename, but none that I could find showing how to…
Contango
  • 76,540
  • 58
  • 260
  • 305
34
votes
4 answers

Sink does not release file

I know that the sink() function can be used to divert R output into a file, e.g. sink('sink-closing.txt') cat('Hello world!') sink() Is there a simple command to close all outstanding sinks? Below, I elaborate on my question. Suppose that my…
I Like to Code
  • 7,101
  • 13
  • 38
  • 48
11
votes
1 answer

Serilog : choose which sink to log at runtime

I'm going to implement Serilog within .net standard 2.0 library. I'm looking for a way to choose which sink(s) should be used for each log line. Lets say that we define 2 sinks within the configuration (console & file) : Log.Logger = new…
Kurt Colemonts
  • 133
  • 1
  • 7
10
votes
1 answer

Serilog MSSqlServer sink not writing to table

I have the following statement in my Startup.cs: Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.ColoredConsole() .WriteTo.MSSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=myDb.Logging;Trusted_Connection=True;",…
Ricky Hicks
  • 152
  • 1
  • 9
8
votes
2 answers

R function Sink isn't redirecting messages or warnings to a file

I am looking to redirect stderr and stdout messages to an output file. Here's what I tried: sink("outputFile" ,type = c("output", "message")) print("using print") cat("using cat\n") message("using message") warning("using warning") When I run this…
Bschrein
  • 83
  • 1
  • 4
8
votes
1 answer

Sink is full when calling rmarkdown::render

I'm following this short tutorial to print my R script directly as an HTML document. It should be pretty straightforward. With a few small changes to the header and comments of an otherwise normal R script, calling the…
elisa
  • 965
  • 9
  • 27
7
votes
1 answer

R sink(): Error, cannot split the message connection

I am trying to log the errors and warnings of an R script into an external file. At the same time I want to be able to see the errors and warnings in the console in RStudio (useful to develop and debug). I am trying to use the following…
user2348684
  • 361
  • 4
  • 17
7
votes
1 answer

separate screen for output in R?

I am using RStudio for my project, I want a separate screen for the output. I tried with sink(), but I need a new pop up window. My code…
varun cyriac
  • 161
  • 1
  • 2
  • 10
7
votes
1 answer

How to capture RCurl verbose output

I have the following request library(RCurl) res=getURL("http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=RCurl&btnG=Search", .opts=list(verbose = TRUE) ) and would like to capture the verbose output of the call (i.e.,…
cryo111
  • 4,444
  • 1
  • 15
  • 37
6
votes
2 answers

Raku cloned object not sunk

class A { has $.n; # If this method is uncommented then the clone won't be sunk # method clone { # my $clone = callwith(|%_); # return $clone; # } method sink(-->Nil) { say "sinking...$!n" } } sub ccc(A:D $a) { $a.clone(n=>2)…
cowbaymoo
  • 1,202
  • 5
  • 14
6
votes
1 answer

Redirect all NLog output to Serilog with a custom Target

As a step in switching from NLog to Serilog, I want to redirect the standard wiring underlying standard invocations of NLog's LogManager.GetLogger(name) to Bridge any code logging to NLog to forward immediately to the ambient Serilog Log.Logger -…
Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
6
votes
4 answers

How to avoid 'sink stack is full' error when sink() is used to capture messages in foreach loop

In order to see the console messages output by a function running in a foreach() loop I followed the advice of this guy and added a sink() call like so: library(foreach) library(doMC) cores <- detectCores() registerDoMC(cores) X…
Roger
  • 677
  • 2
  • 8
  • 19
5
votes
1 answer

Flink stream going to two sinks based on conditions

Trying to see the possibility of stream going to two sinks based on conditions. Requirement is stream have events, all events after transformation need to go to one sink ( assume one kafka topic) And only error events needs to go to another sink (…
mohit nagpal
  • 103
  • 11
5
votes
1 answer

R sink() message and output to same file - sanity check

I'm using R's sink() function to capture errors, warnings, messages and console output into a single text file. I'm wondering if simultaneously sinking both message and output types to a single open file is bad to do? I capture all of the above into…
dooboze
  • 81
  • 8
5
votes
0 answers

sink() within source() in R not working properly

I have the following code: source("file.R") and file.R includes: tab<-table(variable) sink("variable.txt") tab sink() However, the variable.txt file is empty. Any idea why ? I am using RStudio Version 0.99.902 and R version 3.3.1, on a Mac OS X El…
Bernd
  • 91
  • 7
1
2 3
12 13