Displaying 2 results from an estimated 2 matches for "vecnames".
2010 Nov 27
1
return vector of element names for vector, matrix or array
...and returns a
vector in row-major order,
I'd like to write a function to take such an object and return the
dimension names,
pasted with some separator, as a similar vector.
Here is something ugly cobbled together to demonstrate what I want: a
function to work
for any number of dimensions.
vecnames <- function(x, sep=':') {
if (is.vector(x) || length(dim(x))==1) return(names(x))
else if (length(dim(x)==2)) {
snames <- dimnames(x)
return (as.vector(outer(snames[[1]], snames[[2]], paste, sep=sep)))
}
else {
stop("How to handle 3+...
2009 Nov 11
2
Error in lm() function
Hi all,
I wanted to have a seasonality study like whether a particular month has
significant effect as compared to others. Here is my data :
0.10499 0 0 1 0 0 0 0 0 0 0 0
0.00259 0 0 0 1 0 0 0 0 0 0 0
-0.06015 0 0 0 0 1 0 0 0 0 0 0
0.10721 0 0 0 0 0 1 0 0 0 0 0
0.03597 0 0 0 0 0 0 1 0 0 0 0
0.10584 0 0 0 0 0 0 0 1 0 0 0
0.02063 0 0 0 0 0 0 0 0 1 0 0
-0.03509 0 0 0 0 0 0 0 0 0 1 0
-0.03485 0 0 0