search for: samprows

Displaying 2 results from an estimated 2 matches for "samprows".

Did you mean: samplerows
2007 Feb 19
3
Randomly extract rows from a data frame
Hi, I am looking for a way to randomly extract a specified number of rows from a data frame. I was planning on binding a column of random numbers to the data frame and then sorting the data frame using this bound column. But I can't figure out how to use this column to sort the entire data frame so that the content of the rows remains together. Does anyone know how I can do this? Hints
2008 Jan 04
2
R2WinBUGS sending variables as factors
...1.0E-6) } ##R Code library(R2WinBUGS) library(Rlab) #sampling functions #get a subset of the data to use in the modelling process LearnSamp <- function (dBUGS) # data frame of the variables of interest { rnames<- row.names(dBUGS) sampRows <- sample(rnames,900) learnSamp <- subset(dBUGS,rnames%in%sampRows) } #maybe not needed index.inits <- function () # get data into correct form for R2WinBUGS d <-LearnSamp(dBUGS) YFTCPUE <- d$CPUE Month <- d$Month Lat <- d$Lat SeaW <- d$S...