search for: ltrs

Displaying 4 results from an estimated 4 matches for "ltrs".

Did you mean: ltr
2009 Jun 25
3
Efficient lookup on a two-dimensional table
...'s a way to do this without an explicit loop. Example: #x is the 2-d table that holds the values x <- matrix(rnorm(26*12),nrow=26) rownames(x) <- letters colnames(x) <- month.name #y is a data frame that has the "keys" I want to use as indices into x y <- data.frame(ltrs=sample(letters,5),mnths=sample(month.name,5),values=0) #I want to fill in the "values" column using the "ltrs" and "mnths" columns as keys to look up # the associated value from x #One way to do this is with a FOR loop for (i in 1:nrow(y)) {y$val[i] <- x[y$ltrs...
2016 Jan 25
4
Corregir mismo ID para individuos diferentes en una serie temporal
...database$Month_Capt[database$ID_original==x]))%%48))names(newID)<-(unique(database$ID_original)) new_df<-data.frame(database$ID_original,database$Month_Capt,IDcond=NA,new_ID=NA)for(i in unique(database$ID_original)){ new_df[new_df[,1]==i,3]<-newID[[which(unique(database$ID_original)==i)]]}ltrs<-c(LETTERS,apply(combn(LETTERS,2,simplify = T),2,function(x) paste(x,sep = "",collapse = ""))) letterwrap <- function(n, depth = 1) { args <- lapply(1:depth, FUN = function(x) return(LETTERS)) x <- do.call(expand.grid, args = list(args, stringsAsFactors = F)) x &l...
2016 Jan 26
2
Corregir mismo ID para individuos diferentes en una serie temporal
...atabase$Month_Capt[database$ID_original==x]))%%48))names(newID)<-(unique(database$ID_original)) new_df<-data.frame(database$ID_original,database$Month_Capt,IDcond=NA,new_ID=NA)for(i in unique(database$ID_original)){ new_df[new_df[,1]==i,3]<-newID[[which(unique(database$ID_original)==i)]]}ltrs<-c(LETTERS,apply(combn(LETTERS,2,simplify = T),2,function(x) paste(x,sep = "",collapse = ""))) letterwrap <- function(n, depth = 1) { args <- lapply(1:depth, FUN = function(x) return(LETTERS)) x <- do.call(expand.grid, args = list(args, stringsAsFactors = F)) x &...
2016 Jan 26
2
Corregir mismo ID para individuos diferentes en una serie temporal
...se$ID_original==x]))%%48))names(newID)<-(unique(database$ID_original)) >> new_df<-data.frame(database$ID_original,database$Month_Capt,IDcond=NA,new_ID=NA)for(i >> in unique(database$ID_original)){ >> new_df[new_df[,1]==i,3]<-newID[[which(unique(database$ID_original)==i)]]}ltrs<-c(LETTERS,apply(combn(LETTERS,2,simplify >> = T),2,function(x) paste(x,sep = "",collapse = ""))) >> letterwrap <- function(n, depth = 1) { args <- lapply(1:depth, FUN = >> function(x) return(LETTERS)) x <- do.call(expand.grid, args = list(args, &...