Displaying 5 results from an estimated 5 matches for "newvec".
Did you mean:
newver
2002 Jun 13
1
A random insertion position in a vector
...e <-
function(current)
{
## Update the array of cells with a birth followed by a death
parent <- sample(seq(along = current), 1) # index of the parent
pos <- parent - sample(c(0,1), 1)
newcell <- ## generate the new cell based on the type of the parent
newvec <- insert(current, newcell, pos)
newvec[-sample(seq(along = newvec), 1)]
}
Can anyone come up with a cleaner way of doing the insertion or
perhaps the complete birth/death step?
--
Douglas Bates bates at stat.wisc.edu
Statistics Department 608/...
2015 Apr 30
2
búsqueda y sustitución masiva
...on(data, oldvalue, newvalue) {
# convertir los factores en caracteres
if (is.factor(data)) data <- as.character(data)
if (is.factor(oldvalue)) oldvalue <- as.character(oldvalue)
if (is.factor(newvalue)) newvalue <- as.character(newvalue)
# crear el vector de retorno
newvec <- data
# poner los valores registrados en la posición correcta del vector de
retorno
for (i in unique(oldvalue)) newvec[data == i] <- newvalue[oldvalue == i]
newvec
}
recoderFunc(url.origin$V1, url.des$url1, url.des$url2)
Cualquier idea sobre como poder resolverlo u orientación p...
2007 Jul 28
5
the large dataset problem
Dear useRs,
I recently began a job at a very large and heavily bureaucratic organization. We're setting up a research office and statistical analysis will form the backbone of our work. We'll be working with large datasets such the SIPP as well as our own administrative data.
Due to the bureaucracy, it will take some time to get the licenses for proprietary software like Stata. Right
2012 Feb 23
1
segfault when using data.table package in conjunction with foreach
...- data.table(df0)
setkey(DT,ID1,ID2)
ss <- DT[,sum(sharing),by="ID1,ID2"]
if (nrow(df0) == 0L)
break
chunk <- chunk + 1L
cat("Processing chunk", chunk, "... ")
idd <- as.matrix(subset(ss,select=1:2))
newvec <- as.vector(as.matrix(subset(ss,select=3)))
ans[idd] <- ans[idd] + newvec
cat("OK\n")
}
ans
}
require(foreach)
require(doMC)
registerDoMC(cores=2)
num <- 8891
nr <- 500000000L #500 million rows at a time
MMM <- foreach(IT = 1:2) %dopar%...
2013 Mar 23
4
Converting a character vector to numeric
Hello again,
Let say I have following vector:
Vec <- c("0.0365780769", "(1.09738648244378)", "(0.812507787221523)",
"0.5778069963", "(0.452456601362355)", "-1.8900812605", "-1.8716093762",
"0.0055217041", "-0.4769192333", "-2.4133018880")
Now I want to convert this vector to numeric vector. I