Thursday, August 18, 2016

Typesetting Sweave documents with bibliographies

When you just have to make a quick plot, you can script R on the console, but when you do an experiment and want to be able to reproduce it, scripts are no good. I architect a solution and then use an IDE like RStudio to write a program. Once I have the wrangling and helper functions working the way I need, I copy them from their R files into a Sweave template and continue from there.

Today I got stuck because I was using a bibliography and RStudio could not typeset it.

It turns out, that RStudio just appears to run the LaTeX typesetting command, not the pdflatexmk script, so Biber is not called. When you want to work fast and just point and click instead of typing on the command line, you double-click on the tex file and typeset it in TeXShop.

Unfortunately, that does not work out-of-the-box because the Sweave package is part of the R distribution but not the TeXLive distribution. The solution is to make a copy of the two Sweave style files in your local TeXLive texmf directory. Here are the four steps for the current MacOS versions:

  1. go to /Library/Frameworks/R.framework/Resources/share/texmf/tex/latex
  2. copy Rd.sty and Sweave.sty
  3. go to ~/Library/texmf/tex/latex and paste the two files
  4. do a sudo texhash

Now you can typeset your Sweave documents both in Studio and TeXShop. The latter is handy only when you need to redo the bibliography, glossary, or index: you can keep working just in RStudio.

The very first line in your LaTeX file, before the class declaration, should be

% !TEX TS-program = pdflatexmk

Quantile-Quantile Plot

Tuesday, August 9, 2016

A new open forum for scientists working on color

The American Association for the Advancement of Science (AAAS) is setting up a new platform for scientific collaboration called Trellis. A key feature is that you can upload papers you want to discuss and anybody in the group can read the paper online: the AAAS takes care of all the copyright issues with the journal publisher. Another feature is that you can control how much noise you get from Trellis. Messages can have up to 2500 characters, but if you have longer text you can create a PDF and upload it like a paper. The same holds for images and videos.

Many AAAS members are teachers: if you do crowd-sourced experiments, you can easily find subjects. The AAAS is also involved in policy making in Washington, in case you need help with that. You can also announce conferences and other scientific events, and use the shared calendar.

Trellis is currently in pilot phase for educators, policy makers, and Section T of AAAS (Information, Computing, and Communication). There are still a few rough edges that are being ironed out. That might be why you have not yet heard of Trellis.

I am setting up a group called Computational Color Science in Section T. However, we are trying out something new. We are making it a completely open group, i.e., anybody with the URL can sign up and participate, without having to be an AAAS member. To join, go to You can invite anybody else you want by giving them the URL and they can sign up.

Monday, August 8, 2016

Retina from iPS cells

On 29 July 2016, the Japan News by the Yomiuri Shinbun reported that the transplant of iPS cells has been approved in Kobe.

The ethics committee of the Kobe City Medical Center General Hospital has approved a surgery plan to transplant retina developed from donor-derived induced pluripotent stem (iPS) cells to an eye-disease patient. The hospital in Kobe will aim to carry out the surgery, part of the world’s first clinical study of iPS cells, in the first half of 2017, after getting the green light from the government.

The subject of the treatment will be a patient with age-related macular degeneration, a serious disease that can lead to blindness. The Riken Center for Developmental Biology, or CDB, will generate retina from iPS cells, supplied by Kyoto University’s Center for iPS Cell Research and Application, from donors with no blood ties to the patient.

Link to the article