haotu : an open lab notebook

2017/06/22

Automatic MIT License for R Packages

Filed under: errors in R, R, R Stats — Tags: , — S @ 07:01
devtools::use_mit_license()
Advertisements

2016/06/24

save rda data file with compression

Filed under: errors in R, R, R, R Stats — Tags: , , , , — S @ 06:36
save(mydata,file="mydata.rda",compress="xz")

find non-ascii in R

Filed under: errors in R, R, R, R Stats, Uncategorized — Tags: , , , , — S @ 06:34
tools::showNonASCII(readLines("myfiles.R"))

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.

Create a free website or blog at WordPress.com.