Category: UncategorizedReplacing Values in a Vector with NA in ROctober 01, 2012 # Load data files
dataA <- read.table("dataA.csv", header=TRUE, sep=",")
# Replace zeros in column ColA with NA
dataA$ColA <- replace(dataA$ColA, data$ColA == 0, NA)Categories: Uncategorized Tags: R Simple CDF Graph in R August 10, 2012 Below is a sample script for R for creating a cumulative distribution frequency (CDF) graph with one or more curves.
# Load data files
dataA <- read.table("dataA.csv", header=TRUE, sep=",")
# Create CDF points
count <- length(dataA$ColA)-1
cdf.dataA <- data.frame(x=sort(dataA$ColA), y=c(0:count)/count)
# Setup graph parameters
xrange <- c(0, 10)
yrange <- c(0,1)
colors <- c('black') # 'gray39', 'gray69'
linelabels <- c('DataA')
linetype <-c (1)
# Setup output
postscript("cdf.ps", width=5, height=4)
#png("cdf.png", width=400, height=300)
# Setup basic plot
plot(xrange, yrange, type='n', main='', xlab='ColA', ylab='CDF')
# Add lines to plot
lines(cdf.dataA$x, cdf.dataA$y, type='l', col=colors[1], lwd=2,
lty=linetype[1])
# Add legend
legend(xrange[1], yrange[2], col=colors, lwd=2, lty=linetype,
legend=linelabels)
# End output
dev.off()
Categories: Uncategorized Tags: R Installing Packages in R March 07, 2012 You can install packages in R by running the following command within R: install.packages(c("pkg1", "pkg2"))
(See http://cran.r-project.org/doc/manuals/R-admin.html#Installing-packages for more information.) Categories: Uncategorized Tags: R Makefile for ACM Publications in LaTeX October 18, 2011 Below is the Makefile I use for compiling ACM publications. The Makefile LATEX = latex
BIBTEX = bibtex
PDF = ps2pdf
PDF_FLAGS = -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true \
-dEmbedAllFonts=true -dEPSCrop=true
PS = dvips
PS_FLAGS = -P cmz -t letter
WORKINGBASE = main
CAMERABASE = final
default: working
working: version $(WORKINGBASE).pdf
camera: $(CAMERABASE).pdf
gs -q -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -sDEVICE=pdfwrite \
-sOutputFile=$<.tmp $<
mv $<.tmp $<
version:
svnversion > version.tex
%.pdf: %.ps
$(PDF) $(PDF_FLAGS) $<
.PRECIOUS:%.ps
%.ps: %.dvi
$(PS) $(PS_FLAGS) $< -o $@
$(WORKINGBASE).dvi: $(wildcard *.tex) $(wildcard *.bib) $(wildcard images/*.eps)
$(LATEX) ${@:.dvi=}
$(BIBTEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
$(CAMERABASE).dvi: $(wildcard *.tex) $(wildcard *.bib) $(wildcard images/*.eps)
$(LATEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
clean:
rm -rRf *.dvi *.aux *.blg *.log *.ps *~ *.bbl *.pdf *.out
I also set the svn propedit svn:ignore .and add the following: *.aux *.bbl *.blg *.log *.dvi *.ps version.tex main.pdf (Change Categories: Uncategorized Compiling LaTeX Publications for Conference Proceedings July 25, 2011 As a computer science graduate student, compiling LaTeX publications for conferences is a frequent task. For the draft and submission versions, compilation settings are not as particular, but a final camera ready version has certain requirements, such as a PDF with embedded fonts. I have built a Makefile that allows me to compile everything from my early drafts to the final camera-ready version that meets the requirements of typical ACM publications. The Makefile assumes your main LaTeX file is called main.tex (change the value assigned to the
LATEX = latex
BIBTEX = bibtex
PDF = ps2pdf
PDF_FLAGS = -dPDFSETTINGS=/prepress
PS = dvips
PS_FLAGS = -t letter
BASE = main
CAMERABASE = camera
.PRECIOUS:$(CAMERABASE).ps
all: version $(BASE).pdf
camera: $(CAMERABASE).pdf
version:
svnversion > version.tex
%.pdf: %.ps
$(PDF) $(PDF_FLAGS) $<
%.ps: %.dvi
$(PS) $(PS_FLAGS) $< -o $@
$(BASE).dvi: $(wildcard *.tex) $(wildcard *.bib) $(wildcard images/*.eps)
$(LATEX) ${@:.dvi=}
$(BIBTEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
$(CAMERABASE).dvi: $(wildcard *.tex) $(wildcard *.bib) $(wildcard images/*.eps)
$(LATEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
$(LATEX) ${@:.dvi=}
clean:
rm -rf *.dvi *.aux *.blg *.log $ *~ *.bbl *.out
rm -rf (BASE).ps $(BASE).pdf $(CAMERABASE).pdf
Categories: Uncategorized Tags: latex, subversion Parse a CSV File Using Awk July 06, 2011 To perform text processing on a CSV file row-by-row, you can use awk. A single row can be split into columns using the cat myfile.csv | awk '{ split($0,a,","); print a[1]","a[3]; }'
It is important to note that awk uses one-based array indexing (not zero-based). Categories: Uncategorized Tags: awk Enable Uploads in MediaWiki May 02, 2011 To enable uploads (images and PDFs) in MediaWiki, make the following changes to the LocalSettings.php file for the installation:
Categories: Uncategorized Tags: mediawiki CS Unplugged June 25, 2009 CS Unplugged is a series of learning activities designed for elementary, middle, and high school students which teach computer science topics without using a computer. I was first introduced to CS Unplugged at SIGCSE 2008. This week, another computer science student and I did three different activities with teachers which attend a workshop on computational sciences at Marquette University. Other activities are available online at http://csunplugged.org.Categories: Uncategorized |
SearchCategories
Also see Emily & Aaron's Blog Tagsacm apt awk bash benchwork bibtex c compiz dd-wrt dia dvd eeebuntu eeepc eps excel fedora firefox flash freebsd gnome hostname iptables java kde latex mac os x mail merge mediawiki mercurial mrtg nvidia pdf perl phidgets postscript powerpoint printer putty pxe python R route scenery sed snmp ssh structures subnet subversion sudo ubuntu vegetarian vim visio windows word wrt54gl x11 yum Years |