Sunday, December 19, 2010

Reading copy/pasted data into an array in R

If you copy data from somewhere and paste it into R, you can easilyt import it as a data.frame using the textConnection function

dat <- textConnection("1 0 7 0 0 1 0 0 0 5 0 0 0 0 2 0 0 0 0 1 0 0 0 1
1 0 0 1 0 0 0 3 0 0 0 0 1 0 0 0 1
0 0 0 1 0 0 0 2 0 0 0 0 1 0 0 0 1 0 1 0 0 1
1 0 0 1 0 3 0 0 0 0 1 0 0 0 1
0 0 0 1 0 0 0 2 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 2 1 0 1 0 1")
df <- data.frame(scan(dat, fill = TRUE, what = as.list(rep(1, 29))))

Thursday, December 16, 2010

Ubuntu login problem

gdm says:" error initiating conversation with authentication system - general failure"

The problem was solved after commenting out the following row in /etc/pam.d/gdm

@include common-pamkeyring

Hacking Linux rescue mode

http://www.linuxtopia.org/online_books/system_administration_books/ubuntu_starter_guide/ch08.html#gainrootinstallcd

Monday, December 13, 2010

R commander plugin

install.packages("RcmdrPlugin.HH")
library(RcmdrPlugin.HH)

Quick-R

http://www.statmethods.net
http://graphpad.com/quickcalcs/posttestintro.cfm

Friday, December 3, 2010

Line to polygon conversion in GRASS

http://osgeo-org.1803224.n2.nabble.com/converting-lines-to-polygons-td5557002.html

v.in.ogr -o dsn=C:\path\to\shapefile\or\dxf.file output=circles1 type=line
v.clean input=circles1 output=circles2 tool=snap,break,rmdupl thresh=0.2,0,0
v.type input=circles2 output=circles3 type=line,boundary
v.centroids input=circles3 output=circles4 option=add

Be sure to play with the treshold parameter of v.clean