How to load and Mathml formula into Libreoffice - mathml

I have a MATHML formula (generated by, i.e., http://www.mathtoweb.com/cgi-bin/mathtoweb_online.pl). I want to paste it into Libreoffice. How could I do that?
Or even better, I want to convert it to an odf-formula standard.

Latest Libreoffice v 5.1 can import mathml formulas directly from clipboard. Currently 5.1 is beta, but you may download beta builds here
The screenshot is in Russian (my beta supports only russian lang, unfortunately), but it's oblious how to do it (Tools -> Import MathML from clipboard)

Did you try to use the "import formula" functionality?
Just insert a new formula object:
And you have two methods to import. The first one, import the MathML as XML:
For import, paste the MathML code into a text file and save it using the file name extension .mml. This way, LO Math should recognize the MathML content and convert it into its internal format.
The second method, "Import MathML from Clipboard" (supported in LO 5.2):

Related

Copy a math formula from Word DocX to CkEditor

Basically I have to copy many math formulas from a docx document in CKEditor.
I tried in so many ways but I can not find a solution.
Using Word 2013 I can to copy the formula as a linear text getting a result like this
z_(i,j)=100-((x_(i,j)-ยต_j ))/s_j 10
Starting from this math formula
In CKEditor I use the mathjax plugin to insert laTeX formulas.
How can I do this???
Thanks!
From the mathjax documentation on their website:
MathJax allows you to include mathematics in your web pages, either
using LaTeX, MathML, or AsciiMath notation, and the mathematics will
be processed using javascript to produce HTML, SVG or MathML equations
for viewing in any modern browser.
The format of the math formula you provided is AsciiMath. You should probably read the documentation on it:
http://docs.mathjax.org/en/latest/asciimath.html
According to the plugin for ckeditor website however (http://ckeditor.com/addon/mathjax), it only says it supports TeX formulas, there is no mention of AsciiMath, so you might have to actually modify the plugin or just convert your equations to TeX format, it's a pretty easy syntax.
The syntax can be found here:
https://en.wikibooks.org/wiki/LaTeX/Mathematics

Turn off scientific notation before writing to file

My data.frame uses the scientific notation, when parsing files like 3.007530e+07.
I definitely like to use it in R, however, for this analysis I have to transfer my data to csv and open it in excel(German Version), which cannot handle this notation.
My df looks sth like that:
df <- c(6.402000e+05,9.312903e+05,1.007800e+06,1.142000e+06,1.298500e+06,1.511700e+06,1.749000e+06,1.869357e+06)
I tried changing my global options such as options(scipen=999), which does not work, because then I have problems with my fread function.
Therefore, my question:
How to change the notation in a data.frame before, using write.csv()?
I appreciate your replies!
As an alternative to altering the R format (since you want to keep scientific notation in R), could you change how Excel imports your file?
For example, naming your csv file with a non-standard extension to trigger the manual importing process (import wizard), instead of automatically opening the file in the wrong format?
I tried a simple test with a csv formatted file of numbers in scientific notation, saved with a ".sci" filename. My version of Excel launched the wizard, then imported the file and handled the scientific notation correctly [MS Excel Starter 2010, English version].
Edit: I found the reference to using an unrecognized file extension to trigger Excel's import wizard: http://excelribbon.tips.net/T012201_Avoiding_Scientific_Notation_on_File_Imports.html
[The article suggests using .DAT, which I wouldn't use for an ASCII file, but I wanted to give credit where it's due for the idea.]

How to open SAS files using Excel?

I have a set of SAS data sets and I want to open it using Excel or R. I don't have a SAS software with me so i can't use the export option in it. Is there any converter that converts from SAS7BDAT to excel?
Thanks
I help develop the Colectica for Excel addin, which opens SAS data files in Excel. No SAS software or ODBC configurations are required. The addin directly reads the SAS file and then inserts the data and metadata into your worksheet.
Imports SAS .sas7bdat data and column names
Imports SAS .sas7bcat formats and value labels when avalaible
The Excel addin is downloadable from http://www.colectica.com/software/colecticaforexcel
Documentation is available in the user manual.
You could use SAS add in for Microsoft office to open the SAS dataset in Excel. Not sure if it is free though.
http://support.sas.com/software/products/addin/
As Reese suggested you can use - SAS Universal Viewer , its free!!
Here is the link :-
https://support.sas.com/downloads/browse.htm?fil=&cat=74
Or you can download SAS University Edition, which is also free, it is more than just a viewer, you can write and execute programs in here.
http://www.sas.com/en_us/software/university-edition/download-software.html
Here a quick-and-dirty python five-liner to convert a .xpt file to .csv
import pandas as pd
FILE_PATH = "(directory containing file)"
FILE = "ABC" # filename itself (without suffix)
# Note: might need to substitute the column name of the index (in quotes) for "None" here
df = pd.read_sas(FILE_PATH + FILE + '.XPT', index=None)
df.to_csv(FILE_PATH + FILE + '.csv')
Hopefully this might help someone
I came across the same "need" and after some research here and there, I found a nice and easy way with R and the latest version of RStudio (as per 2020 June date - the FREE one). Using it, you can open various formats of files and RStudio generates for you the R script it ran behind. You can use this as a starting point, in order to have the .sas7bdat file opened, and then do the conversion step.
Steps to follow in order to import the file using the RStudio "visual" way: Evironment tab -> Import Dataset -> From SAS...
It will ask you to import the haven library. After the installation you will have a tab with the preview of the data within the file and also the R script ran behind which will look like this:
library(haven)
aux <- read_sas("//PATH_ON_YOUR_MACHINE_TO_FILE/actual_file.sas7bdat", NULL)
View(aux)
Notice the NULL there, it has the purpose of converting empty strings to NULL.
But wait, we also need to convert it to a .csv file in order to have the final job done. For this you simply add below those lines from above the following:
write.csv(aux, "actual_file.csv")
Which will produce within the same folder with the original SAS file, the desired .CSV one. If you want to have ";" as separator instead on "," use write.csv2(aux, "actual_file.csv"). Anyway Strings are enclosed by " " so it should be fine.

Importing the contents of a word document into R

I am new to R and have worked for a while as follows. I have the code writen in a word document, then I copy and paste the document with the code into R as to have the code run which works fine, however when the code is long (hundred pages) it takes a significant amount of time in R to start making the code run. This seems rather not a very effective working procedure and I am sure there are other forms to compile the R code.
On another hand one of then that comes to my mind is to import the content of word into R which I am unsure how to do. Have tried with read.table but it does not work, have look on internet as to how to import data, however most explanations are all for data tables etc or internet files in the form of data tables and similar. I have tried saving the document into csv. however word does not include csv have tried with Rich text format and XML package but again the instructions from the packages are for importing tables and similars. I am wondering if there is an effective way for R to import a word document as is in the word document.
Thank you
It's hard to say what the easiest solution would be, without examining the word document. Assuming it only contains code and nothing else, it should be pretty easy to convert it all to plain text from within Word. You can do that by going to File -> Save As, and use 'plain text' under 'Save as type'.
Then edit the filename extension to .R from .txt, download a proper text editor (I can recommend RStudio for R), and open your code in it. Then you will be able to run the code from inside the editor without using copy / paste.
No, read table won't do it.
Microsoft Word has its own format, which includes a lot of meta data over and above the text you enter into it. You'll need a reader/parser that understands the Word format.
A Java developer would use a library like Apache POI to read and parse it into word tokens and n-grams.
Look for Natural Language Processing tools, like this R module:
http://cran.r-project.org/web/views/NaturalLanguageProcessing.html

How to open WinBUGS odc file in R?

I'm currently using Ubuntu, R, and JAGS. I'd like to explore a few WinBUGS examples that are available on the web, such as those available on the website accompanying the book, Bayesian Modeling Using WinBUGS: An introduction.
However, the analyses are stored in the odc format e.g., this one.
I can open the file with a text editor and it does show the model syntax in plain text and in some cases data and so forth. However, I was wondering:
Is there an existing R function that extracts important elements of a WinBUGS odc file?
I would recommend compile odcread and use it to convert .odc files to text files and read it with any text editor.
for f in *.odc; do
odcread ./"$f" > ./"${f%.odc}.txt"
done
The best way is to go and install WinBUGS.
See http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/contents.shtml
You can then open any of these directly there, and copy them for use wherever you want.

Resources