This question already has answers here:
How to leave the R browser() mode in the console window?
(3 answers)
Closed 8 years ago.
In RStudio, I started a debug mode by
debug(ls)
ls()
Then I do not know how to end this mode.
The prompt changed to
Browse[2]>
How can I end this debugging mode?
First quit debugging the function with Q at the Browse[2]> prompt as jbaums tells you in his comment. This takes you back to the > prompt. Now turn off the debugging on ls with this command:
undebug(ls)
?debug is helpful for this sort of thing.
Use debugonce() instead of debug(). As the name suggests, this will only take the function through debug mode once. When in debug mode hit continue to run through the end or the next breakpoint or use the stop button to end the debug session.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 months ago.
Improve this question
I am using vi editor for UNIX. Sometimes I am experiencing an issue with getting out of vi editor, where I go to press esc then type ":wq" or "q!" to quit, but it is not escaping. vi editor just enters weird symbols/characters and I can't get out. What do I do to escape and exit when esc won't escape?
There are few more commands for that apart from the one you are using
Shift+zz to save (if modified )and exit
:cq quit without writing
EDIT :
I found some more commands that I just learned .
There are many ways to exit from vi editors, and you can use some of these commands to exit from other editors
Press F2, this will drop you in Insert Mode, now press: q and hit enter
another way is to press Ctrl + c or ctrl + z command to exit the vi editor forcefully.
press ZZ (shift+z+z). it will save and exit.
Ctrl + [ will also work like escape key.
the 3rd , and 6th command may or may not work on every system, as it depends on terminal's setting and system itself.
or you can do map certain keys to behave like escape, please refer this post , that will save you some keystrokes.
For me this worked:
CTL + c (this is equal to ESC in your case)
:wq! (to write save and quit) and then click enter
have you tried ESC then "ZZ"?
seems to work as a last result for me.
This can happen when vi is started with TERM=linux. You can use the set term command to solve this problem.
Set the TERM to vt100 with one of the following commands depending on the shell.
csh or tcsh: setenv TERM vt100
sh: TERM=vt100; export TERM
ksh, bash, or zsh: export TERM=vt100
vi should work without setting the terminal in kx mode(refer to this for a similar issue: https://unix.stackexchange.com/questions/86742/term-linuxxterm-vi-in-an-xterm-or-the-aaabbbbbbccddd-problem).
In order to save this, add the set TERM command to ~/.vimrc file so the option is loaded when starting vi.
Have you tried ^z followed by "kill" the process?
I just had this issue with editor of command line of Git Bash and what worked was press Esc and then :q!. When I typed only q!, it did not work.
press the following shift + esc
look at bottom left corner
write the following colon included :wq
I wonder if it is possible to check to see if a window has focus in AutoIt. I have checked and not found much. I have tried using WinSetOnTop but this didn't seem to do anything so then I considered using WinActivate but this didn't seem to do what I need.
The reason I want to do this is because I have this application I am writing as a prank and I do not want the co-worker on whom I'm playing the prank to just ignore the window when it starts automatically. I am wanting to put a shortcut to it in the startup folder and we have several applications that run on startup and so I want mine to either always be on top or audibly shout rude words at the user if they try and ignore the application.
Is this possible and, if so, can you help me out because I am out of ideas.
Regardless of your motives, you may try WinWaitActive.
Syntax:
WinWaitActive ( "title" [, "text" [, timeout = 0]] )
Example that may be useful to try it out:
Func Example()
; Run Notepad
Run("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
WinWaitActive("[CLASS:Notepad]", "", 10)
; Wait for 2 seconds to display the Notepad window.
Sleep(2000)
; Close the Notepad window using the classname of Notepad.
WinClose("[CLASS:Notepad]")
EndFunc ;==>Example
Reference:
https://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm
This question already has answers here:
How to press "Ctrl+Shift+Q" in AutoIt
(2 answers)
Closed 4 years ago.
I am new in AutoIt. I have run the notepad by using the following code in AutoIt:
Run("notepad.exe")
Now I want to quit the application by using "ALT+F4". How to press "ALT+F4" with AutoIt tool?
You'll want to check out the documentation for AutoIt - which is pretty good.
The one you're looking for is: https://www.autoitscript.com/autoit3/docs/functions/Send.htm
Keep in mind that you want to make sure that the window is active or that you're targeting the window.
With that, I recommend using this : https://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm
ControlSend() works in a similar way to Send() but it can send key
strokes directly to a window/control, rather than just to the active
window.
The following code for pressing "ALT+F4" should work in AutoIt:
Send("{ALT down}{F4 down}{F4 up}{ALT up}")
OR,
Send("!{F4}")
OR,
Send("!{F4}", 0)
I am trying to pause my code for a little while, time for me to observe the plots.
I tried:
print('A')
something = readline("Press Enter")
print('B')
print('C')
, then there is no pause, the line print('B') is fed to readline and get stored into something and therefore only A and C got printed on the screen. Note that if I add an empty line between Something = readline("Press Enter") and print("B"), then print("B") get printed on the screen but still the console doesn't allow the user to press enter before continuing.
And I tried:
print('A')
Sys.sleep(3)
print('B')
print('C')
The program waits 3 seconds before starting and then run "normally" without doing any pause between print('A') and print('B').
What do I missunderstand?
Here is my R version: R 3.1.1 GUI 1.65 Snow Leopard build (6784)
The problem with readline is that if you paste your script into an R console, or execute it from eg Rstudio, the redline function is read and then the next line of the script is read in as the console entry, which in your case sets the value of something to print('B).
An easy way to get around this is to stick your entire code in a function, then call the function to run it. So, in your case:
myscript = function(){
print('A')
something = readline(prompt = "Press Enter")
print('B')
print('C')
}
myscript()
The output of this for me (in Rstudio, with R version 3.1.1):
[1] "A"
Press Enter
[1] "B"
[1] "C"
This has always felt like a bit of a hack to me, but it's essentially what the readline documentation recommends in its example.
I've never used sleep in my code, so I can't help you there.
Edit to clarify based on comments: This will only work if myscript() is the very last line of your script, or if it is manually entered into the console after running the script to generate the function. Otherwise, you will run into the same problem as before- the next line of code will be automatically entered.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Equivalent to unix “less” command within R console
I am using R under unix in bash.
Sometimes the output of a command has more lines than the bash.
How do I prevent the output from scrolling away? I.e. is there some equivalent of less and less -S in R?
A way to do this in R is also to redirect to a file:
sink("a_file.txt")
...your_commands...
sink()
I think the page() function is like having | less in an R session. It allows two representations of the object; i) a version you'd get from dput(), and ii) a version you'd get if you print()-ed the object.
dat <- data.frame(matrix(rnorm(2000), ncol = 5))
page(dat, method = "print")
It might be possible to wrap your expression in capture.output, and then page the result to the terminal.
pager <- function(cmd,nlines=10){
output = capture.output(cmd)
pages = seq(1,length(output),by=nlines)
for(p in pages){
f = p
l = min(p+nlines-1,length(output))
cat(paste(output[f:l],"\n"))
readline("*more*")
}
return(invisible(0))
}
Usage: pager(ls()), then hit Return (not space or anything else) at each 'more' prompt.
currently it doesn't return the value. Oh and it fails if there's no output. But you can fix these :)
Or use emacs with ESS and let it all scroll back...
Wouldnt
any_command | more
work fine?
“the bash” has no lines, your terminal has.
You can set the number of lines of your terminal in the settings of that application.
Your question is unclear. If you're talking about using R interactively and accidentally running a command which spits out a huge number of lines, run something like this in your R session: options(max.print=4000)