A little trick in reading data
January 31, 2005 at 7:58 pm | In Data manipulation, GNU-R | Leave a CommentCensus 1991 Primary Census Abstract files use a variable which is an 18 digit string. The string is a code that comprises codes for district, tehsil, block, panchayat and village. The village and town directories, however, give data for each village where villages are identified by three variables that capture the same codes for district, block and village (but in three different variables). To match the two sets of data, the 18 digit string had to be split into five different variables. Here is a little piece of code that did it.
#take out the variable code from distvc into a separate data frame called code
data.frame(distvc$CODE)->code
#write this data frame into a text file
write.table(code,”code”,col.names=FALSE,row.names=FALSE,quote=FALSE)
#read this text file using read.fwf, reading five different variables
read.fwf(“code”,width=c(2,4,4,4,4))->code2
#assign names to these variables
names(code2)=c(“DIST_CODE”, “THSIL_CODE”, “BLOCK_CODE”, “PANCH_CODE”, “VILL_CODE”)
#combine the new data frame code2 with the old data frame distvc
cbind(distvc,code2)->distvc
#delete the temporary objects
rm(code,code2)
Installation issues
January 30, 2005 at 9:10 pm | In Linux | Leave a CommentI see that a lot of people are having trouble with installation of ESS and Emacs on windows machines. Please go through John Fox’s article on installation. Fox uses Xemacs instead of emacs. The difference between emacs and xemacs is not of much consequence for the moment. Other than this difference, John Fox’s article is a perfect guide to all installation issues.
BTW, emacs was written by Richard Stallman, founder of the Free Software Foundation. There is much on the web on the split between him and the group that went on to develop Xemacs.
Vikas
R-help mailing list
January 27, 2005 at 3:36 am | In GNU-R | Leave a CommentSubscription to the R-help mailing list is a must. You can subscribe by either going to the website or by sending an e-mail to r-help-request@stat.math.ethz.ch with “help” (without quotes) as the subject. Please enrol, read the posts, and use it to find answers to your problems. If you have not used mailing list before, have a look at the posting guide to learn the basic ethics of participating in a mailing list.
Vikas
GNU-R
January 26, 2005 at 9:15 pm | In GNU-R | Leave a CommentI will record useful snippets of code in R, the open source release of S programming language, on V. under the category GNU-R. The main intended users of these are the students of a course on econometrics I teach at the Centre for Economic Studies and Planning. In the long run, I hope it will benefit everybody trying to learn R.
Vikas Rawal
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.