Monday, December 16, 2013

Updating values in hierarchical lists

How to parse and update a hierarchical list using an elegant single command? A lot of things can be done with a single command in R. This (after a few considerations) turned out not an exception either.

Friday, December 6, 2013

Fixing the blurry R fonts caused by DPI scaling on Windows 7

R does not play well with high DPI scaling on Windows 7.  Fonts look blurry on my 27 inch WHDQ monitor with 150% DPI scaling.  Fixing that for 32-bit R was easy.  Go to the properties of C:\Program Files\R\R-3.0.2\bin\i386\Rgui.exe. Note, you may need to replace the R version number in that path. Then open the "Compatibility" tab check the box "Disable display scaling on high DPI settings" and you are done. Once you try to do the same for 64-bit counterpart C:\Program Files\R\R-3.0.2\bin\x64\Rgui.exe you'll see the grayed out check box that can not be altered. The solutions requires editing the registry and is described here
http://superuser.com/questions/355915/vista-dpi-scaling-cannot-disable-dpi-scaling-for-wireshark/355953#355953?s=97656833-4e08-4a55-8773-1fe68b5fca77
Brief instructons.
Go to
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Most likely you'll already see a setting for 32-bit Rgui.exe
Make a similar one by right clicking on the "Layer" and add new string value.
Name: C:\Program Files\R\R-3.0.2\bin\x64\Rgui.exe
Type: REG_SZ
Data: HIGHDPIAWARE

Saturday, November 16, 2013

Exploring S4 Objects in R


Looking what is inside of a particular method.
Method - spectra
Class - MSnExp
If method is exported (check NAMESPACE) then this will work.
getMethod("spectra","MSnExp")
Method Definition:
function (object) 
{
    sl <- as.list(assayData(object))
    fnames <- featureNames(object)
    return(sl[fnames])
}

Signatures:
        object  
target  "MSnExp"
defined "MSnExp"

Showing slots for a given class
showClass("MSnExp")

showMethods(classes="MSnExp", where="package:MSnbase")
The link to check http://missingreadme.wordpress.com/2011/01/04/how-to-see-the-code-for-s4-methods-in-r/
Debugging
trace(show, tracer=browser, signature=c(x="eSet"), where=getNamespace("Biobase"))

Thursday, November 7, 2013

Where are the R libraries?

on Mac
/Library/Frameworks/R.framework/Versions/3.0/Resources/library
on Win
c:/Users/vlad/R/win-library/3.0

Checking font availability on Mac   fc-list : family | grep "Fira Code"   or   system_profiler -json SPFontsDataType | grep \...