Is there any way or magic word that can direct the code to print to specific location (output below the cells or console). I'm imagining something like below.
The reason I'm asking is, I have a sets of asynchronous co-routine started running from jupypter notebook, which constantly print some output to show the result which I want them constantly showing in the console. Meanwhile I want to using jupyter notebook to see some of object for debugging, and I only want to print some values in the cell output.
%print_here
print('hello')
%print_to_console
print('hello')
Related
After commenting out print statements in an included file, the data from the old print statements are still shown even if I delete the cell.
The solution was to exit the notebook file and open it again and re-run the cells. Also, you can clear all outputs as shown here :
https://youtrack.jetbrains.com/issue/PY-51862/Feature-Request-Add-clear-all-outputs-to-Jupyter-Notebook
by pressing double shift and then searching for "Clear Outputs", but for me that didn't prevent the old print statements from still being displayed.
Chunk output inline setting not working.
I started R for my daily work, and when ran a code (simply display a subset of a data frame) nothing is shown, neither inline nor on the console or viewer. I have set absolutely nothing differently, didn't even touch the settings. It says "Chunk output inline" anyway.
It was working normally for a year, and now from a day to the other, this happens. If I execute the subsetting in the console, then it displays the subset in the console. But if I execute in the chunk, no displaying anywhere.
Thanks in advance
I have an rsweave file that I run almost twice a week. Last time I used it a change a couple of things and when I run it to compile to pdf I got the following errors:
The pdf compiles complitly, and the only thing I notice that the error did is that the the pdf output has a extra page (the first one) all blank. I don't know how to make a reproducible example of the errors because I don't know whats the cause of it. But any way I just want to know generally how to debug a rsweave file when getting latex error like the ones in the picture
You don't say how you are running Sweave, but that looks like RStudio. To debug something like this, just run Sweave explicitly in the R console, e.g. if your input file is source.Rnw, run
Sweave('source.Rnw')
This will produce source.tex. Open that file in a text editor and look at the start of it. You will see that \Schunk is used on line 27, but \begin{document} doesn't occur until sometime later.
My guess is that you added some text or a code chunk to the header. All text belongs after \begin{document}.
Edited to add: It turns out from the comments below that you were using print(...) in a code chunk before \begin{document}. In Sweave, print output goes into the document. If you want a message to show up in the console log but not the document, use message("some text"). You'll also need to suppress the echoing of the command if you want to do this in the document header. For example,
<<echo=FALSE,results=hide>>=
message("Started at ", Sys.time())
#
will result in something like this in your console log:
1 : keep.source term hide (Untitled.Rnw:6)
Started at 2017-09-27 08:28:33
and nothing in the document.
I mistakenly printed to much to the output during a single cell's execution and now the browser tab completely freezes every time that notebook is opened. I tried restarting ipython and it didn't help (I am guessing that each time it is loaded, also all the chunk of text is loaded with it).
Is there a way to load a notebook with outputs suspended or clear?
One hack if you're desperate: open the .ipynb file, which is a text file. Scroll down to the lengthy cell output and delete it. Of course, you need to be careful that the result is still a valid .ipynb file.
nbstripout is a simple tool that removes all output from a notebook (without needing to open the notebook in your browser).
your code will be saved in the form of JSON. open it with json viewer and carefully delete the unwanted output cell and save it back.
I want only the output not the commands, and I want to see the output on the console at the same time.
I tried sink and capture.output , but tried to work through the examples but I can accomplish only one of the task i.e. either to console or to a file.
I am new to R, and was thinking whether there is a function that can help me see the output on the console and save it to a text file as well?
Do sink(file="file.txt", split=TRUE).