Displaying 3 results from an estimated 3 matches for "strvect".
Did you mean:
strvec
2001 Feb 06
1
AW: Proposal: Generalizing unique() and duplicated()
..."duplicated" <- function(object, ...)
{
if (data.class(object)=="matrix")
return(duplicated.matrix(object, ...))
else
UseMethod("duplicated")
}
"duplicated.matrix" <-
function(mat, MARGIN=1) # defaulting to work on rows
{
strvect <- drop(apply(mat, MARGIN, function(x) paste(x, collapse = "\r")))
return(duplicated(strvect))
}
"unique.matrix" <-
function(mat, MARGIN=1) # defaulting to work on rows
{
dup <- duplicated.matrix(mat, MARGIN)
return(if (MARGIN==1) mat[!dup,] else mat[,!dup]...
2001 Feb 05
2
variable pattern
Suppose I've got p vectors x1, ..., xp each of length n merged in a (n x
p)-matrix X.
Now I want to calculate the number of distinct values of row-vectors
(x_i1, ..., x_ip).
Is there a way to do this in R? Thanks in advance,
Jan.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send
2001 Feb 05
2
variable pattern
Suppose I've got p vectors x1, ..., xp each of length n merged in a (n x
p)-matrix X.
Now I want to calculate the number of distinct values of row-vectors
(x_i1, ..., x_ip).
Is there a way to do this in R? Thanks in advance,
Jan.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send