haotu : an open lab notebook

2013/02/20

endnote place references in different places :: endnote move references in different places

Filed under: Uncategorized — S @ 02:40

Just move the bibliography (select + cut/paste or drag) to where you want it in your document. Existing and future references will be listed together at this point, as you’ve now moved the target document-location for the bibliography.

 

http://superuser.com/questions/326917/how-to-set-references-bibliography-page-in-word-endnote

2013/02/15

make selected columns of a dataframe into numeric vectors

Filed under: Uncategorized — S @ 04:21

combs1 <- apply(combs[,1:5], 2, as.numeric)

combs[,1:5] <- combs1

 

2013/02/13

Shorthand methods for model selection in R with step | Model selection with a lot of independent variables to start

Filed under: errors in R, R — S @ 02:44

Make sure data frame includes both dependent and independent variables.

Model code becomes:

glm1 <- glm(Y ~ ., data=kk[, 24:60], family=gaussian)

# use (data=) to select the columns of the data frame, kk, that have both independent and dependent variables in them.  The period after ~ includes all of the columns you indicate in data.

Then proceed with step() or stepAIC() to do model selection.

 

This post is from an avid follower of haotu

in R there are so many times for loops fail due to function fails within the loop

Filed under: errors in R, R — S @ 02:03

 

k<-function(i){(j<-i^2)}

for (i in 1:10)

http://wp.me/pU6J1-KI

{

#Do some awesome function

(k(i))

}

#this results in an error likely since one o the steps of the data set you are processing is not consistent with the other 10 steps.

print(i)

#what step is in error??

for (i in 1:10){try(k)}

try might fix your problem but the steps in the original data set are still not consistent.

2013/02/07

Write a file to the clipboard | Cut and paste R objects

Filed under: Uncategorized — S @ 01:06

There are many times when I want to go from R to a text editor. Unfortunately, the following method only works for windows. it would be nice if someone knew of a way to do it in a Lynux system.

if dat is your data matrix

write.table(dat,file("clipboard","w"))

to copy from R

read.table(file("clipboard","r"))

to paste to R

You may also need to close all connections before this works, and possibly output dat so you see it in the command line

 
closeAllConnections()
dat

OK

Here is a function that seems to work on my system all the time.

clipboard<-function()  ...  coming soon

Blog at WordPress.com.