search for: indvec

Displaying 12 results from an estimated 12 matches for "indvec".

Did you mean: indvecs
2002 Apr 09
1
Problem handling NA indexes for character matrixes (PR#1447)
...ulating genetic data I discovered a problem when indexing into character arrays using NA's: Create a character matrix and a numeric matrix > cmat <- matrix( letters[1:4], ncol=2, nrow=2) > nmat <- matrix( 1:4, ncol=2, nrow=2) Create an index vector containing an NA value > indvec <- c(1,2,NA) Indexing works fine for both matrixes when we only pull off *one* column: > cmat[ indvec, 1 ] [1] "a" "b" "NA" > nmat[ indvec, 1 ] [1] 1 2 NA > cmat[ indvec, 2 ] [1] "c" "d" "NA" > nmat[ indvec,...
2019 Jul 13
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
...cted based on the behavior of many R functions but would preserve the current behavior while granting more fine-grained control to users that feel they need it. A rapidly thrown-together prototype of such a method for the head of a matrix case is as follows: head2 = function(x, n = 6L, ...) { indvecs = lapply(seq_along(dim(x)), function(i) { if(length(n) >= i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) seq_len(ni) }) lstar...
2019 Sep 16
5
head.matrix can return 1000s of columns -- limit to n or add new argument?
...>> while granting more fine-grained control to users that >> feel they need it. >> >> A rapidly thrown-together prototype of such a method for >> the head of a matrix case is as follows: >> >> head2 = function(x, n = 6L, ...) { indvecs = >> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) >> do...
2019 Sep 15
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...y R functions but would preserve the current behavior while granting > more fine-grained control to users that feel they need it. > > A rapidly thrown-together prototype of such a method for the head of a > matrix case is as follows: > > head2 = function(x, n = 6L, ...) { > indvecs = lapply(seq_along(dim(x)), function(i) { > if(length(n) >= i) { > ni = n[i] > } else { > ni = dim(x)[i] > } > if(ni < 0L) > ni = max(nrow(x) + ni, 0L) > else > ni = min(ni, di...
2019 Sep 16
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...more fine-grained control to users that > >> feel they need it. > >> > >> A rapidly thrown-together prototype of such a method for > >> the head of a matrix case is as follows: > >> > >> head2 = function(x, n = 6L, ...) { indvecs = > >> lapply(seq_along(dim(x)), function(i) { if(length(n) >= > >> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = > >> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) > >> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FA...
2019 Jul 08
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
I think of head() as a standard helper for "glancing" at objects, so I'm sometimes surprised that head() produces massive output: M = matrix(nrow = 10L, ncol = 100000L) print(head(M)) # <- beware, could be a huge print I assume there are lots of backwards-compatibility issues as well as valid use cases for this behavior, so I guess defaulting to M[1:6, 1:6] is out of the
2019 Sep 17
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...ntrol to users that >>>>> feel they need it. >>>>> >>>>> A rapidly thrown-together prototype of such a method for >>>>> the head of a matrix case is as follows: >>>>> >>>>> head2 = function(x, n = 6L, ...) { indvecs = >>>>> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >>>>> seq_len(ni) }) lstargs = c(list(x),indvec...
2019 Sep 17
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
...>>>>>>> >>>>>>> A rapidly thrown-together prototype of such a method for >>>>>>> the head of a matrix case is as follows: >>>>>>> >>>>>>> head2 = function(x, n = 6L, ...) { indvecs = >>>>>>> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >>>>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >>>>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >>>>>&g...
2019 Sep 17
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...>>>>> feel they need it. >>>>>> >>>>>> A rapidly thrown-together prototype of such a method for >>>>>> the head of a matrix case is as follows: >>>>>> >>>>>> head2 = function(x, n = 6L, ...) { indvecs = >>>>>> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >>>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >>>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >>>>>> seq_len(ni) }) lstargs =...
2019 Oct 18
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...t;>>> > >>>>>>> A rapidly thrown-together prototype of such a method for > >>>>>>> the head of a matrix case is as follows: > >>>>>>> > >>>>>>> head2 = function(x, n = 6L, ...) { indvecs = > >>>>>>> lapply(seq_along(dim(x)), function(i) { if(length(n) >= > >>>>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = > >>>>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) > &g...
2013 Apr 08
0
prediction.strength in r package fpc
...wrote my code like prediction.strength(data,2,6,M=10,clustermethod=pamkCBI,DIST,krange=2:6,diss=TRUE,usepam=TRUE) because i am using the dissimilarity matrix instead of the data itself for the clustering algorithms. But then i got this error message: Error in switch(method, kmeans = kmeans(xdata[indvec[[l]][[i]], ], k, : EXPR must be a length 1 vector can someone please help me to correct my code? i would be very thankful:) many regards xy [[alternative HTML version deleted]]
2010 Mar 19
2
Dataframe calculations
Hi everyone, My question will probably seem simple to most of you, but I have spent many hours trying to solve it. I need to perform a series of sequential calculations on my dataframe that move across rows and down columns, and then repeat themselves at each unique 'MM' by 'DD' grouping. Specifically, I want to add 'DEPART' time (24 hr time) to 'TRAVEL'(minutes)