Arabic Language for R twitteR package functions - r

I have issues when using some twitteR functions when the language of tweet is Arabic, for example if I use twListToDF() and the tweet is in Arabic I get things like " ", I get the same with getTrends(). But when I make SearchTwiter() I get normal Arabic characters,
Kindly note that I use release 1.1.8.
Am I missing something with configuration or this is an issue with the package?

Try using the following command in the R, before using twListToDF()
Sys.setlocale("LC_CTYPE", "Arabic")

I found your question while searching the internet regarding this same issue, and I found this package "arabicStemR". This might help.

Related

Greek Characters in Julia Jupyter edition

I am using Julia.
I am trying to get some greek characters in Jupyter notebooks.
First I downloaded the latest version of Julia 1.6.2
For the jupyter connection I used anaconda, in julia repl i put ] add IJulia, and then I could chose the Julia kernel in Jupyter.
Then a friend suggested to download vs code (since we got a problem in the working directory with jupyter-anaconda)
In VS code we got no problem with working directories. And to work with notebooks we installed the Jupyter extension. It was working very well, but we got to this problem that we cannot get greek characters.
In Jupyter (anaconda) I could easily put greek characters, like this:
no package needed, nothing, just like that.
However in VSCode I cannot get that, nor "predictive text" or coding suggestions:
Any tips on how to solve this?
Like we are preferring VS Code and we know there's a way to get the greek characters on it, but we don't know how.
Any help is very welcomed.
Thanks in advance.
Check out the docs for the Julia extension in VS code here: https://code.visualstudio.com/docs/languages/julia. Per the comments above, make sure this is installed and you have the Julia kernel selected. You should then see the following:

Arabic text not showing in R-

Just started working with R in Arabic as I plan to do text analysis and text mining with Hadith corpus. I have been reading threads related to my question but nevertheless, still can't manage to get the REAL basics here (sorry, absolute beginner).
So, I entered:
textarabic.v <- scan("data/arabic-text.txt", encoding="UTF-8", what= "character",sep="\n")
And what comes out textarabic.v is of course, symbols (pic). Prior to this, I saved my text in utf-8 as I read in a thread but still nothing shows in Arabic.
I can type in Arabic R but scan brings the text in symbols.
Also read and tried to implement other user's are codes to make Arabic text function but I don't even know how and where to implement them.
I added to R, tm and NLP packages.
What do you suggest for me to do next?
Thanks in advance,
I just posted an answer saying that you must definitely be using R on Windows before I saw your comment that you're on OSX. On OSX the situation is not quite so dire. The problem is that you're using too old a version of R. If I right remember, anything prior to 3.2 does not handle Unicode correctly. Try installing 3.3.3 from https://cran.r-project.org/bin/macosx/ and if necessary re-install the packages you need. Then you should be fine. بالتوفيق!

Installing / Using R Packages in Sublime Text 3

I am trying to use the R function dmvnorm (found in the mvtnorm package) in Sublime Text 3. I installed it and ran my code in RStudio, so I know the code is fine. In sublime, I entered:
install.packages('mvtnorm',repos='http://cran.us.r-project.org')
library(mvtnorm)
It looked as though it worked, but when I ran my code it said:
Error: could not find function "dmvnorm"
I'm using a Mac and my hunch is this is somehow related to specifying the path in Preferences -> Package Settings -> Sublime REPL -> Settings - User. The current path displayed as part of the error reads:
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Thanks!
I had a hard time with this recently as well. I'm very new to R so I'm not sure this is the best answer, but to hold you off until someone gives a better one, did you include library('package.name') in the file (in sublime)? require('package.name') also works, but this appears not to be best practice for reasons described, e.g., here.
I hope this helps!

Error with setwd in R

When trying to use the sample code for SubgraphMining (the example is on 35th page), I get an error:
"Error in setwd(paste(Sys.getenv("R_HOME"), "library", "subgraphMining", :
cannot change working directory"
I'm using RStudio 0.97.551, 32-bit R (2.15.3 - this version of R was recommended to use with subgraphMining), igraph0 (was recommeded too, instead of igraph library), Java installed. Operation system is Windows 8.
Can anyone help me with the issue?
The error message is coming from the gspan function of subgraphMining, from here:
setwd(paste(Sys.getenv("R_HOME"), "library", "subgraphMining",
"parsemis", sep = "\\"))
The reason for it is that R uses / as path separator, and not \\, which only works on windows. A workaround is not modify the function and use / instead of \\.
Btw. this has nothing to do with the igraph package, so I'll remove that tag.
In my case, it displayed the error because I expected it to create a new folder which I mentioned in the path in setwd. Unfortunately, R does not have this functionality and the matter was resolved when I created the folder and then used setwd command.
I know it's almost 1 year since this question was posted. I encountered the same problem with subgraphMining package. A quick hack is: You can write "gspan" on RStudio's command line and it will show the function, copy that function and create your own function in your own script (of course with new name, let's say gspanNew) and fix it by replacing "\\" with "/", as Gabor Csardi pointed out.
Cheers! :)
You can always use file.path("path","with","code") instead of simple paste in order for your code to be OS independent.

How can I have the NEWS displayed in the html help page of an R package?

The help page of the news() R function says:
it is attempted to read its news in structured form from files
‘inst/NEWS.Rd’, ‘NEWS’ or ‘inst/NEWS’ (in that order).
Doing so and installing the package, we get (under windows) a link to the NEWS file at the top of the html page open by the command help(package=packagename). For an example, assuming you have installed party, you can try
help(package="party")
This works however only with files named NEWS. When we provide instead a NEWS.Rd file, there is no link to the news. Try
help(package="survival")
Is there a way to get this link when we provide a NEWS.Rd file?
Thanks for your help.
The problem has been solved since R 3.0.0.
It seems, however, that a series of the Rd formatting code such as \code{} for example are ignored when rendering the NEWS.Rd in html.

Resources