A common data manipulation task is that of making 'wide' data 'long':
for example, using the reshape2 library,
library(reshape2)
wide_df <- data.frame( stringsAsFactors=FALSE,| #!/usr/bin/ruby | |
| # Create display override file to force Mac OS X to use RGB mode for Display | |
| # see http://embdev.net/topic/284710 | |
| require 'base64' | |
| data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
| edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
| vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
Update: I have heard that 10.8.3 has solved this problem for some people, so I rolled back my changes and installed the update. No change on my monitor. Nevertheless, it’d be a good idea to update OS X before trying this, since it may fix the issues with your particular hardware.
I recently bought a MacBook Pro (with ‘Retina’ screen), but when I hooked it up to my Dell U2410 monitor via HDMI cable I was shocked by the poor picture quality. The contrast was all wrong and text was misshapen. No amount of calibration in the monitor or software would fix it.
Short answer: OS X thinks my monitor is a TV, and is using the YCbCr colour space rather than RGB. I had to override an EDID setting to force the RGB colour space, and it is now working correctly.
Long answer: I haven’t owned a Mac for a while and h
| How to Ask for Help using R | |
| ======================================================== | |
| The key to getting good help with an R problem is to provide a minimally working | |
| reproducible example (MWRE). Making an MWRE is really easy with R, and it will | |
| help ensure that those helping you can identify the source of the error, and | |
| ideally submit to you back the corrected code to fix the error instead of sending | |
| you hunting for code that works. To have an MWRE you need the following items: | |
| - a minimal dataset that produces the error |
| library(RColorBrewer) | |
| library(colorRamps) | |
| pdf("rcolorsheet.pdf", paper="a4r", width=11.6, height=8.2, onefile=TRUE) | |
| ### page 1 | |
| # grDevices::colors | |
| m <- matrix(1:660, 60, 11) |
| # A method for modifying only select off-diagonal items in a matrix | |
| # From "Thierry" and "Ben Bolker" | |
| # At http://stackoverflow.com/a/11759744/479554 | |
| # A sample matrix | |
| size <- 6 | |
| mat <- matrix(seq_len(size ^ 2), ncol = size) | |
| print(mat) | |
| # A companion matrix that indicates how "off" a diagonal is: |