Skip to content

Instantly share code, notes, and snippets.

View fawda123's full-sized avatar

Marcus W Beck fawda123

View GitHub Profile
vif_func<-function(in_frame,thresh=10,trace=T,wts=NULL,...){
library(fmsb)
if(any(!'data.frame' %in% class(in_frame))) in_frame<-data.frame(in_frame)
if(is.null(wts))
wts <- rep(1, ncol(in_frame))
if(!is.null(wts))
if(length(wts)!=ncol(in_frame)) stop('length of weights must equal number of variables')
catch.fun<-function(dows,fish.str,net.type='Trap',trace=T,clean=F){
require(XML)
strt<-Sys.time()
#create object for output
fish.out<-data.frame(expand.grid(dows,fish.str),NA,NA)
names(fish.out)<-c('dows','fish','fish.val','result')
#import relevant packages
library(gstat)
library(sp)
library(nlme)
#create simulated data, lat and lon from uniformly distributed variable, exp1 and exp2 from random normal
set.seed(2)
samp.sz<-400
lat<-runif(samp.sz,-4,4)
lon<-runif(samp.sz,-4,4)
#install the packages
install.packages('XML')
require(XML)
#get raw html for Lake Minnetonka
html.raw<-htmlTreeParse(
'http://www.dnr.state.mn.us/lakefind/showreport.html?downum=27013300',
useInternalNodes=T
)