Dear Jamie, is it wise to back up my data at frequent intervals? How should I do that? --Prudence
Dear Prudence, it is very, very prudent to back up your data regularly. Want to know how I know this? Because I accidentally deleted more than 15% of the year 1 data when I got cocky with a merge on Wednesday. Whoops! Let's hear it for backups. To save all your stuff, just do this:
> save.image(file="directory_name/prudent_very_prudent.RData")
Then, dear Prudence, you can come out and play. --Jamie
Dear Jamie, my environment is getting cluttered. How can I clean it out efficiently? --Marla C.
Dear FlyLady, when did you become an R user? It leaves me in purple puddles sometimes too. To do a 27-fling boogie on your environment, use ls() to show you the numbers associated with your objects. Then you can do some mighty mighty rm-ing with those object numbers, like so:
> rm(list=ls()[c(1:35,38:129,131:350)])
That example would delete everything but the objects numbered 36, 37, and 130 or anything beyond 350. (HT) Might want to back up first (see Prudence's question above). While you're on the line, can I ask you to stop sending me Rubba Scrubba ads? --Jamie
Dear Jamie, I am fascinated by the phenomenon of brilliant redheads. I have data on hair color and data on IQ. How can I find out which redheads in my sample have genius-level IQs? --Tiziano Vecelli
Dear TV, you loved them for their brains, huh? Here's how to get the tally, assuming the women have the same ID numbers in both datasets:
> genius.redheads<-intersect(subset(data$ID, data$
The object genius.redheads will list the ID numbers for the redheads whose IQs are above the cutoff you specify. When you find some, send them my way so I don't delete my data again. Thanks and I hope it's not too moldy for your computer in there! --Jamie
Dear Jamie, please help! I am using someone else's dataset and he saved a continuous variable as a factor variable. Whatever shall I do? --Stanford Binet
Dear Stan, fret not. Try this:
> as.numeric(levels(IQ))[IQ]
I still havent figured out how to parse it but it works. (HT) --Jamie
Recent Comments