Displaying 20 results from an estimated 9000 matches similar to: "Subsetting the "ROW"s of an object"
2018 Jun 08
1
Subsetting the "ROW"s of an object
On 06/08/2018 10:15 AM, Michael Lawrence wrote:
> There probably should be an abstraction for this. In S4Vectors, we
> have extractROWS().
FWIW the code in S4Vectors that does what your subset_ROW() does is:
https://github.com/Bioconductor/S4Vectors/blob/04cc9516af986b30445e99fd1337f13321b7b4f6/R/subsetting-utils.R#L466-L476
(This is the default "extractROWS" method.)
Except
2018 Jun 08
3
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 1:49 PM, Hadley Wickham <h.wickham at gmail.com> wrote:
>
> Hmmm, yes, there must be some special case in the C code to avoid
> recycling a length-1 logical vector:
Here is a version that (I think) handles Herve's issue of arrays having one or more 0 dimensions.
subset_ROW <-
function(x,i)
{
dims <- dim(x)
index_list <-
2018 Jun 08
2
Subsetting the "ROW"s of an object
I suspect this will have suboptimal performance since the TRUEs will
get recycled. (Maybe there is, or could be, ALTREP, support for
recycling)
Hadley
On Fri, Jun 8, 2018 at 10:16 AM, Berry, Charles <ccberry at ucsd.edu> wrote:
>
>
>> On Jun 8, 2018, at 8:45 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
>>
>> Hi all,
>>
>> Is there a better to
2018 Jun 08
3
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>
> Also the TRUEs cause problems if some dimensions are 0:
>
> > matrix(raw(0), nrow=5, ncol=0)[1:3 , TRUE]
> Error in matrix(raw(0), nrow = 5, ncol = 0)[1:3, TRUE] :
> (subscript) logical subscript too long
OK. But this is easy enough to handle.
>
> H.
>
> On
2018 Jun 08
0
Subsetting the "ROW"s of an object
There probably should be an abstraction for this. In S4Vectors, we
have extractROWS().
Michael
On Fri, Jun 8, 2018 at 8:45 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
> Hi all,
>
> Is there a better to way to subset the ROWs (in the sense of NROW) of
> an vector, matrix, data frame or array than this?
>
> subset_ROW <- function(x, i) {
> nd <-
2018 Jun 08
4
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 11:52 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
>
> On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles <ccberry at ucsd.edu> wrote:
>>
>>
>>> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>>>
>>> Also the TRUEs cause problems if some dimensions are 0:
>>>
2018 Jun 08
0
Subsetting the "ROW"s of an object
Also the TRUEs cause problems if some dimensions are 0:
> matrix(raw(0), nrow=5, ncol=0)[1:3 , TRUE]
Error in matrix(raw(0), nrow = 5, ncol = 0)[1:3, TRUE] :
(subscript) logical subscript too long
H.
On 06/08/2018 10:29 AM, Hadley Wickham wrote:
> I suspect this will have suboptimal performance since the TRUEs will
> get recycled. (Maybe there is, or could be, ALTREP,
2018 Jun 08
0
Subsetting the "ROW"s of an object
On Fri, Jun 8, 2018 at 2:09 PM, Berry, Charles <ccberry at ucsd.edu> wrote:
>
>
>> On Jun 8, 2018, at 1:49 PM, Hadley Wickham <h.wickham at gmail.com> wrote:
>>
>> Hmmm, yes, there must be some special case in the C code to avoid
>> recycling a length-1 logical vector:
>
>
> Here is a version that (I think) handles Herve's issue of arrays
2015 Apr 01
4
evaluation in transform versus within
On 01/04/2015 1:35 PM, Gabriel Becker wrote:
> Joris,
>
>
> The second argument to evalq is envir, so that line says, roughly, "call
> environment() to generate me a new environment within the environment
> defined by data".
I think that's not quite right. environment() returns the current
environment, it doesn't create a new one. It is evalq() that created
2019 Nov 04
3
Puzzled about a new method for "[".
On 5/11/19 3:41 AM, Hadley Wickham wrote:
> For what it's worth, I don't think this strategy can work in general,
> because a class might have attributes that depend on its data/contents
> (e.g. https://vctrs.r-lib.org/articles/s3-vector.html#cached-sum). I
> don't think these are particularly common in practice, but it's
> dangerous to assume that you can restore a
2016 Jun 26
2
3 minor issues with getClass 'resolve.msg' arg
Hi,
It turns out that two packages (1 Bioconductor, 1 CRAN) define an
S4 class called "Annotated":
library(S4Vectors) # see (*) at bottom for how to install
library(RNeXML)
1st issue
---------
getClass() issues the same warning twice:
tmp <- getClass("Annotated")
Found more than one class "Annotated" in cache; using the first, from
namespace
2019 May 30
2
R pkg install should fail for unsuccessful DLL copy on windows?
thanks for the tip Jan.
However it would be nice if I didn't have to handle this myself for all of
my packages. (and teach my students how to do that)
BTW I tried to disable staged installation, and the issue still happens:
th798 at cmp2986 MINGW64 ~/projects/max-generalized-auc (master)
$ R_INSTALL_STAGED=FALSE R --vanilla -e
2017 Jun 27
2
paste strings in C
Dear R-devs,
Below is a small example of what I am trying to achieve, that is trivial in
R and I would like to learn how to do in C, for very large matrices:
> (mymat <- matrix(c(1,0,0,2,2,1), nrow = 2))
[,1] [,2] [,3]
[1,] 1 0 2
[2,] 0 2 1
And I would like to produce:
[1] "a*C" "B*c"
Which can be trivially done in R via something like:
foo
2013 Jan 18
2
[LLVMdev] Loads not hoisted out of the loop
On 1/18/2013 11:34 AM, Hal Finkel wrote:
>
> I agree. FWIW, I'm currently working on making the LLVM-based Fortran compiler non-hypothetical, and so for several reasons, I'd like to have a solution to this. If we can't think of anything better, we could always fall back to the N^2 metadata solution (explicit mark as no-alias all pairs that don't alias), but I'd rather we
2018 Jun 08
0
Subsetting the "ROW"s of an object
Hmmm, yes, there must be some special case in the C code to avoid
recycling a length-1 logical vector:
dims <- c(4, 4, 4, 1e5)
arr <- array(rnorm(prod(dims)), dims)
dim(arr)
#> [1] 4 4 4 100000
i <- c(1, 3)
bench::mark(
arr[i, TRUE, TRUE, TRUE],
arr[i, , , ]
)[c("expression", "min", "mean", "max")]
#> # A tibble: 2 x 4
2013 Jan 18
0
[LLVMdev] Loads not hoisted out of the loop
On Fri, Jan 18, 2013 at 10:00 AM, Krzysztof Parzyszek <
kparzysz at codeaurora.org> wrote:
> f90_array_type = type { i32 size, double* data };
I am not certain how fortran implements multi-dimensional arrays, but in my
case I'm doing something like
type { i32 nd, i32* dims, double* data };
Perhaps we could add !tbaa.pointer?
!1 = metadata !{ metadata !"int",
2019 Nov 04
3
Puzzled about a new method for "[".
On 04/11/2019 4:40 p.m., Pages, Herve wrote:
> Hi Rolf,
>
> On 11/4/19 12:28, Rolf Turner wrote:
>>
>> On 5/11/19 3:41 AM, Hadley Wickham wrote:
>>
>>> For what it's worth, I don't think this strategy can work in general,
>>> because a class might have attributes that depend on its data/contents
>>> (e.g.
>>>
2016 Feb 18
2
R Package Installation Ignores libPaths Setting
Good day,
If the library path is changed with .libPaths, the command
install.packages("/nb/dario/Biostrings_2.39.9.tar.gz", repos=NULL)
fails with
** testing if installed package can be loaded
Error : package ?S4Vectors? required by ?Biostrings? could not be found
However,
running library(S4Vectors) followed by sessionInfo() after the error shows that the package can indeed be
2019 Jul 08
1
Format printing inside a matrix
A generic for displaying an object in a cell would be a reasonable
solution for this particular problem. However, as soon as you start
treating these objects as data (like putting them into a matrix),
you're likely going to want vectorized operations over them, which
means formalized vector and matrix classes. S4Vectors in Bioconductor
facilitates this for vectors, but not for higher-order
2003 Nov 10
5
Subsetting a list of vectors
Hi,
I'm trying to subset a list which contains variable length vectors.
What I want to do is extract (eg.) the 3rd item in each vector (with
length >= 3). At the moment I'm using sapply(list.of.vectors,
function(x) {x[3]}). The problem with this is that sapply returns a
list of the same length of list.of.vectors so I end up with a whole lot
of null entries from those vectors