If I am typing one letter in HUE IDE in hive notebook, multiple characters are getting typed automatically. As the screenshot is given below. Could you please help me on this.
Related
I am trying to use R in VSCode. I downloaded the R extension and followed the steps specified but I keep getting an annoying issue: when I use Alt+126 to write the character '~' in the script everything is fine, but when I run the line, in the R interactive terminal it appears twice. Also, if I use Alt+126 in the R interactive terminal, '~~' appears instead of '~' (two times the character instead of once). I have no idea why this is happening, I tried to uninstall and reinstall both VSCode and R and reset the pc but nothing changed.
I hope somebody knows how to solve this, thanks in advance!
I am having problems with printing unicode characters in R. Initially the problems started with me trying to plot some custom labels with ggplot, but I have found out that this problem runs deeper.
For example, the letter đ is represented with unicode code U+0100. This means that if I type
"\u0100"
in the console, I should get đ printed as output, right? However, this is not what happens. Instead, as the output I get:
<U+0100>
I don't understand why this is happening since my encoding is set to UTF-8. Does anyone have any ideas on how to solve this?
I tried using the following function:
stri_escape_unicode("<U+0100>")
but I just get the same output as before. Any help would be appreciated! I am using Macbook Pro from 2013.
I've installed R in Sublime Text 3 on my Windows 8.1 64bit as described here:
http://www.kevjohnson.org/using-r-in-sublime-text-3/
However, I don't know how to push code to the R console.
This same problem is described here, but the suggested solutions don't work for me (Using the menu items/Changing the syntax):
Not able to run selected lines in REPL R in sublime text
I don't even understand what kind of shortcut Ctrl+Shift+,,l is supposed to be. Pressing Control and Shift down and then entering two commas and an l?
I hope someone can help me answer my very first question on Stackoverflow.
I hadn't heard of Repl until this post. I just checked it out. It turns out the double character means "release". So "Ctr - shift - comma", release, and then press "L". Let me know it that helps you run a line in the console.
In R I always like to print out the script since it gives a good overview and one can adjust eventual errors. I like the syntax highlighting in R-Studio because it facilitates reading and fast comprehension of code.
Is there a way to print out the text with the highlighting I see in the editor?
Its not an R-Studio solution, but notepad++ will print R source with syntax highlighting.
RStudio will not print in colour, but it's easy to save the code as a PDF; in this case the syntax format is preserved. My favourite package is knitr.
library(knitr)
stitch("file_name.R")
The default output is PDF/Markup in .tex. If you prefer not to typeset, running the below will export as .html
stitch(script="file_name.R", system.file("misc", "knitr-template.Rhtml", package="knitr"))
Brief explanation
The reason this is an answer to this question in because of the last line of the question:
Is there a way to print out the text with the highlighting I see in
the editor?
so we are not limited to only and only using Rstudio software here.
After exploring the awesome answer by #rrg and realizing that it runs the code line by line, I wrote a comment below his answer and continued googling. My problem is that the code I wrote is so large and so time consuming to run that running it for the sake of having a syntax highlighted version is not feasible.
Most of the solution out there online involves having notepad++ which is a Windows application and I'm a dedicated Linux user, so I searched for a way I can do this in Linux (and possibly Mac)
The way I solved it:
Inspired by a blog post, I used the famous and beloved Vim to convert R to syntax highlighted HTML and then because you can open HTML in your browser, you can what ever you want with it (print, screenshot, etc.)
Activate synax highlighting in Vim:
open terminal
then open the vim config file by typing vim ~/.vimrc
press i from keyboard to go to "insert mode"
go to the end of the file using arrow keys on your keyboard
type syntax on at the end of the file
now you need to save and exit. For this you need to press Esc button from keyboard to come out of "insert mode" and then type :x and press Enter to save and close the file.
if you want to change the color scheme of the syntax highlighting, visit the bottom part of this website
From terminal open your file with Vim:
vim YOUR_FILE_PATH
Having you R code open in vim, you can turn on the line numbers if you like by pressing Esc and then write :set number and press Enter.
For converting R to HTML, press Esc to make sure you are not in "insert mode" and then type :TOhtml and press Enter. This will result is having a split window in terminal, half is your R code and the other half id your new HTML code.
For saving the files, type :x along with Enter button from keyboard twice to save both files (your R file will be unchanged if you have not typed anything extra in it and your HTML file will be created with the same name near your R code)
Now open it with your favorite browser (in my case Vivaldi) and do what ever you want (in my case converting the whole HTML into PNG)
Best way:
download https://github.com/jaredpetersen/codeprinter and paste in the r code. then choose syntax highlighting Xcode
For those using a Mac (and thus without access to Notepad++) cutting and pasting into Xcode and printing from there will also work.
As with Ron Jensen's earlier comment, this isn't an R Studio solution, but in the interests of "just getting it to work", I hope this helps someone.
I'm using a headless gnuplot working great without X, but the problem is that it asks me to press enter after each plot so I can't do multiple plots in a script, they just don't generate when I try to do them without being able to press enter (with fork for example).
How can I plot headlessly without asking for the user to push enter?
Final edit: The problem was actually that I was using the wrong gnuplot binary. It works "headlessly" fine even with no one there to press confirm. So no need to export GNUTERM. See my other question for more details on the gnuplot binary.
Old Answer:
export GNUTERM=dumb
This tells gnuplot not to ask the user for anything and just run. I think it should be on by default but whatever. I set this env variable before running my scripts and they just run now without asking for input.
Edit: while it solved the problem, it seems like this doesn't actually do what I'm saying it does. Apparently this just tells gnuplot to plot in ASCII format? It still outputs my pngs though.
Double edit: It may have been all due to using the wrong gnuplot binary actually.