similar to: surprising behaviour of names<-

Displaying 20 results from an estimated 10000 matches similar to: "surprising behaviour of names<-"

2008 Oct 17
2
using ifelse with surprising results
Thanks for the gracious assistance in advance I'm working on a non-metric scaling problem and am calculating the distance for input to isoMDS Here is the code library(MASS) vegdata <- tapply(Percent, list(PRIMARY_VE, MASTERID), sum) x.mat <- matrix(x, nrow=40, ncol=2750, byrow=TRUE, dimnames = c(dimnames(x)[1], dimnames(x)[2])) vegdata.dd <- dist(x) vegdata.dd <-
2020 Feb 19
3
dimnames incoherence?
Hi, I was bitten by a little incoherence in dimnames assignment or may be I missed some point. Here is the case. If I assign row names via dimnames(a)[[1]], when nrow(a)=1 then an error is thrown. But if I do the same when nrow(a) > 1 it's OK. Is one of this case works unexpectedly? Both? Neither? a=as.matrix(1) dimnames(a)[[1]]="a" # error: 'dimnames' must be a list
2020 Feb 19
2
dimnames incoherence?
>>>>> Martin Maechler >>>>> on Wed, 19 Feb 2020 18:06:57 +0100 writes: >>>>> Serguei Sokol >>>>> on Wed, 19 Feb 2020 15:21:21 +0100 writes: >> Hi, >> I was bitten by a little incoherence in dimnames assignment or may be I >> missed some point. >> Here is the case. If I assign row names
2017 Jun 06
2
surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)
Hi, It's nice to be able to define S4 classes with slots that correspond to standard attributes: setClass("A1", slots=c(names="character")) setClass("A2", slots=c(dim="integer")) setClass("A3", slots=c(dimnames="list")) By doing this, one gets a few methods for free: a1 <- new("A1", names=letters[1:3])
2017 Jun 06
1
surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)
I've fixed this and will commit soon. Disregard my dim<-() example; that behaves as expected (the class needs a dim<-() method). Michael On Tue, Jun 6, 2017 at 5:16 AM, Michael Lawrence <michafla at gene.com> wrote: > Thanks for the report. The issue is that one cannot set special attributes > like names, dim, dimnames, etc on S4 objects. I was aready working on this >
2006 May 31
1
Inconsistent behaviour when manipulating a ts object with frequency = 12 or 4
Dear All, I found the following under R 2.3.0 on WINXP (tested on 2 PCs, I do not have access to Linux from this PC, sorry ... ) > set.seed(10) > x <- ts(rnorm(6),frequency=7) > x Time Series: Start = c(1, 1) End = c(1, 6) Frequency = 7 [1] 0.01874617 -0.18425254 -1.37133055 -0.59916772 0.29454513 0.38979430 > x[24] <- NA > x Time Series: Start = c(1, 1) End = c(1, 6)
2023 May 03
1
Inquiry about the behaviour of subsetting and names in matrices
Hello, I have stumbled upon a few cases where the behaviour of naming and subsetting in matrices seems unintuitive. All those look related so wanted to put everything in one message. 1. Why row/col selection by names with NAs is not allowed? x <- setNames(1:10, letters[1:10]) X <- matrix(x, nrow=2, dimnames = list(letters[1:2], LETTERS[1:5])) x[c(1, NA, 3)] # vector: works
2005 Oct 27
1
data.frame-question]
First a general comment on posting style, could you please be more specific about where the error occurs as without this it is very difficult to identify what the problem is. Now concerning your problem. When I tried the code I posted yesterday I thought it worked fine. I've tried it again now and found that the data.frame TAB3 actually only has one column and the names "A",
2023 Oct 29
1
dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)
Hello, the fix of PR18612 (https://bugs.r-project.org/show_bug.cgi?id=18612) in r85380 (https://github.com/wch/r-source/commit/2653cc6203fce4c48874111c75bbccac3ac4e803) caused a change in `dim<-()`. Specifically, in the past, any `dim<-()` assignment would _always_ remove "dimnames" and "names" attributes per help("dim"): The replacement method changes
2023 Oct 30
2
dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)
>>>>> Henrik Bengtsson >>>>> on Sun, 29 Oct 2023 10:42:19 -0700 writes: > Hello, > the fix of PR18612 > (https://bugs.r-project.org/show_bug.cgi?id=18612) in > r85380 > (https://github.com/wch/r-source/commit/2653cc6203fce4c48874111c75bbccac3ac4e803) > caused a change in `dim<-()`. Specifically, in the past,
2023 Oct 31
1
dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)
Hi Martin, Henrik, I actually like this change. Makes a lot of sense IMO that dim(x) <- dim(x) be a no-op, or, more generally, that foo(x) <- foo(x) be a no-op for any setter/getter combo. FWIW S4Arrays::set_dim() does that too. It also preserves the dimnames if the right value is only adding or dropping outermost (ineffective) dimensions: ??? > x <- array(1:6, dim=c(2,3,1),
2005 Oct 15
1
drop() and "["(), and apply()
I have two queries about the behaviour of drop() and apply() regarding the dimnames and names(dimnames) of the answer. I would appreciate any comments on this behaviour. I will submit any of this as a bug report if I am encouraged to do so. The first query, concerning drop(), seems to me to be a bug in ?drop, and possibly also in the function. ?drop: [...] Any accompanying 'dimnames'
2016 Sep 07
3
R (development) changes in arith, logic, relop with (0-extent) arrays
Martin I'd like to make a comment; I think that R's behaviour on 'edge' cases like this is an important thing and it's great that you are working on it. I make heavy use of zero-extent arrays, chiefly because the dimnames are an efficient and logical way to keep track of certain types of information. If I have, for example, a <- array(0,c(2,0,2)) dimnames(a) <-
2002 Feb 23
3
Non-destructive channel reversal
I'd like to know if there's a way to non-destructively reverse L-R channels in an ogg vorbis file? I've been recording live classical sources, but until tonight haven't listened to them on anything with even approaching decent stereo separation. Well, you guessed it. Why the hell are the violins on the right and the brass on the left? Checked my equipment and sure enough, cable
2007 Apr 19
2
setClass inside a function
Hello, I would like to create a function that gets passed a class name and then calls setClass, and a few other functions, inside. I have done this in the past with setmethod, creating accessors for all slots in a set of S4 classes. But setClass is choking when my function is called isnide a package, telling about an error in exists(cname, where). I assume this to be a problem with the
2011 Apr 19
1
How to Extract Information from SIMEX Output
Below is a SIMEX object that was generated with the "simex" function from the "simex" package applied to a logistic regression fit. From this mountain of information I would like to extract all of the values summarized in this line: .. ..$ variance.jackknife: num [1:5, 1:4] 1.684 1.144 0.85 0.624 0.519 ... Can someone suggest how to go about doing this? I can extract the
2015 Dec 17
1
array() ignores illegal non-list dimnames
Is there a reason that array() silently ignores dimnames that are not a list but matrix() gives an error? > str(matrix(11:14, 2, 2, dimnames=c("Rows","Cols"))) Error in matrix(11:14, 2, 2, dimnames = c("Rows", "Cols")) : 'dimnames' must be a list > str(array(11:14, dim=c(2, 2), dimnames=c("Rows","Cols"))) int
2008 Aug 08
1
operating on arrays of unknown dimensionality
Dear R-users, I am looking for a way to assign to slices of arrays where dimensionality of the array is not a-priory known. Specifically, I would like to be able to generalize the following example of dimensionality 2 to an arbitrary diminsionality: In this example we create an array x, a smaller array y and then assign y to a slice of x. > dimnmx <- list(c('a','b'),
2011 Apr 12
1
extract element from list by rownames
Hi, I've a list of list. I want to extract an element by the rownames. I can extract it by: data[[1]][[1]][[4]][1] But I want to exctract it by a command like this: data[[1]][["B0"]][["smac"]][["cont"]][1] It's possible? Thanks, Alfredo > str(data) List of 1 $ :List of 4 ..$ :List of 4 .. ..$ : num [1, 1:3] 0.4 0.458 0.5 .. ..$ : num
2006 Nov 17
1
Manipulating R lists in C
Hi, I have been studying the R manual on lists but cannot seem to create a simple R list in C - I keep on getting "'dimnames' applied to non-array" whenever I attempt to assign names to the list elements: Wanted output a list structure something like [ type="Bid", price=2.0, volume=1000 ] I can get up to a list of [ "Bid2, 2.0, 1000 ] But for the life of