similar to: Vector-subsetting with ZERO - Is behavior changeable?

Displaying 20 results from an estimated 10000 matches similar to: "Vector-subsetting with ZERO - Is behavior changeable?"

2011 May 17
4
subsetting a list of dataframes
Hello All, I have a list of dataframes, and I need to subset it by keeping only those dataframes in the list that meet a certain criterion. Specifically, I need to generate a second list which only includes those dataframes whose number of rows is > 1. Could someone suggest how to do this? I have come close to what I need with loops and such, but there must be a less clumsy way... Many
2013 Mar 12
2
Bugs due to naive copying of list elements
Several bugs are present in R-2.15.3 and R-alpha due to naive copying of list elements. The bug below is due to naive copying in subset.c (with similar bugs for matrices and arrays): a<-list(c(1,2),c(3,4),c(5,6)) b<-a[2:3] a[[2]][2]<-9 print(b[[1]][2]) Naive copying in mapply.c leads to the following bug: X<-1+1 f<-function(a,b) X A<-mapply(f,c(1,2,3),c(4,5,6),SIMPLIFY=FALSE)
2007 Oct 30
1
Dynamically changeable parameters in theora
hi all, please can anyone tell me that what are the possible parameters in theora codec, that can be changed dynamically in execution time like DCT coefficient matrix frame rate....etc. ( still i do not know whether those are dynamically changeable) -- ----------- Regards, Janaka Priyadarshana
2013 Feb 05
1
Remove and add to many matrices in list.
Hi all, I realised that my last email question and code was probably going to be a bit of an eyesore for some people and that perhaps the best thing for me to do is to pose the question of what it is I want to achieve, rather than what I''ve written, if it helps people: I''m writing a simulation, and during that simulation I have a list of matrices – of variable number of
2012 Nov 27
2
Stuck trying to modify a function
Hi, I have the following data: Path_Number <- 5 ID.Path <- c(1:Path_Number) # Make vector of ID's. No_of_X <- sample(50:550, length(ID.Path), replace=TRUE) # X <- split(sample(1:10000, sum(No_of_X), replace=TRUE), rep(ID.Path, No_of_X)) Y <- lapply(X,function(x) sample(x, round(runif(1, min=10, max=50)))) X and Y are both lists, and I've made the following function to
2018 Jul 30
3
r338291 - Remove trailing space
I apologize that my two patches "Remove trailing space" (r338291 in clang, r338293 in llvm) are committed without a discussion happening within the community. Forward to llvm-dev and cfe-dev to see if they are what the community would like to see committed or not. The original discussion is at this thread http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180730/236802.html On
2018 Jul 30
3
apply with zero-row matrix
Hi Martin, Fair enough for R functions in general. But the behaviour of apply violates the expectation that apply(m, 1, fun) calls fun n times when m has n rows. That seems pretty basic. Also, I understand from your argument why it makes sense to call apply and return a special result (presumably NULL) for an empty argument; but why should apply call fun? Cheers David On Mon, 30 Jul 2018 at
2009 Sep 02
1
Problem at subsetting matrix by using dimnames
Given: > mitest <- matrix(1:16,ncol=4) > dimnames(mitest)[[1]] <- c("a","b","c","d") > dimnames(mitest)[[2]] <- c("a","b","c","d") > mitest a b c d a 1 5 9 13 b 2 6 10 14 c 3 7 11 15 d 4 8 12 16 I can do: > mitest[cbind(c(1,2,3),c(2,3,2))] [1] 5 10 7 but using the names does not
2019 Feb 23
1
Return/print standard error in t.test()
>>>>> peter dalgaard >>>>> on Fri, 22 Feb 2019 12:38:14 +0100 writes: > It's not a problem per se to put additional information > into class htest objects (hey, it's S3 after all...) and > there is a precedent in chisq.test which returns $observed > and $expected. It seems the consent is to simply return the SE but *not*
2016 Feb 08
2
inconsistency in treatment of USE.NAMES argument
Hi, Both vapply() and sapply() support the 'USE.NAMES' argument. According to the man page: USE.NAMES: logical; if ?TRUE? and if ?X? is character, use ?X? as ?names? for the result unless it had names already. But if 'X' has names already and 'USE.NAMES' is FALSE, it's not clear what will happen to the names. Are they going to propagate to the result
2007 Feb 19
2
Another subsetting enigma
Hello again, I'm trying to do the following: subset(dataframe,list %in% strsplit(dataframe[[Field]],",")) But This returns always the complete dataframe, since the strsplit(dataframe[[Field]],",") is evaluated as one big list for the whole data frame rather than one list per row. How can I have this evaluated on a per row basis? After 1.5 h hitting head against wall -
2015 Aug 03
2
'vapply' not returning list element names when returned element is a length-1 list
Hi all Sorry for the confusing title. I noticed the following inconsistency: If i have a function that returns a named list with 2 (or more) elements, then using 'vapply' retains the names of the elements: > vapply(1:3, function(x) list("foo" = "bar", "hello" = "world"), > vector("list", 2)) [,1] [,2] [,3] foo
2016 Feb 11
2
inconsistency in treatment of USE.NAMES argument
Changing the vapply() behavior makes sense in principle. I analyzed the CRAN code base using the R parser and found 143 instances of calling vapply with USE.NAMES=FALSE. These would need to be inspected to understand the consequences of the change. For reference: /AzureML/R/datasets.R:226 /BBmisc/R/toRangeStr.R:33 /DBI/R/DBDriver.R:205 /Kmisc/R/str_rev.R:37 /Matrix/R/diagMatrix.R:98
2020 Jul 10
2
lapply and vapply Primitive Documentation
The documentation of ?lapply includes: > lapply and vapply are primitive functions. However, both evaluate to FALSE in `is.primitive()`: is.primitive(vapply) #FALSE is.primitive(lapply) #FALSE It appears that they are not primitives and that the documentation might be outdated. Thank you for your time and work. Cole Miller P.S. During research, my favorite `help()` is
2012 Apr 19
2
Trouble with [sv]apply
Friends I clearly donot understand how sapply and vapply work. What I have is a function that returns a matrix with an indeterminate number of rows (some times zero) but a constant number of columns. I cannot reliably use an apply function to assemble the matrices into a matrix. I am not sure it is possible. I can demonstrate the core of my confusion with this simple code. A.f <-
2019 Feb 19
4
code for sum function
The algorithm does make a differece. You can use Kahan's summation algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm) to reduce the error compared to the naive summation algorithm. E.g., in R code: naiveSum <- function(x) { s <- 0.0 for(xi in x) s <- s + xi s } kahanSum <- function (x) { s <- 0.0 c <- 0.0 # running compensation for lost
2011 Dec 02
2
Problem subsetting: undefined columns
Dear R-users, -I am new to R, and I am struggling with the following problem. -I am repeating the following operations hundreds of times, within a loop: I want to subset a data frame by columns. I am interested in the columns names that are given by the rows of another data frame that was built in parallel. The solution I have so far works well as long as the elements of the second data frame
2020 Nov 17
3
formatting issue with gcc 9.3.0 on Ubuntu on WSL2
I just got a new Windows laptop (i7, 10th generation CPU), installed 'Windows Subsystem for Linux 2' and then installed Ubuntu 20.04 and used 'apt-get install' to install packages that the R build seems to require. In particular, I am using gcc version 9.3.0. The build went without a hitch but the tests showed that deparse(1e-16) produced "1.00000000000000e-16" instead
2020 Jan 23
1
[External] Re: rpois(9, 1e10)
On 1/20/20 12:33 PM, Martin Maechler wrote: > > It's really something that should be discussed (possibly not > here, .. but then I've started it here ...). > > The NEWS for R 3.0.0 contain (in NEW FEATURES) : > > * Functions rbinom(), rgeom(), rhyper(), rpois(), rnbinom(), > rsignrank() and rwilcox() now return integer (not double) > vectors.
2007 Jul 18
2
Subsetting Enigma: More rows after dataframe[-list,]?
Hello again, I'm trying to purge the indexes in i.delete from frame and end up with more rows!? Please be so kind and let me know where I screw this up ... Joh > i.delete [1] 40 45 165 212 253 270 280 287 301 352 421 433 463 467 487 [16] 517 537 542 573 594 596 612 614 621 635 650 696 699 707 732 [31] 738 776 826 891 892 936 937 935 940 976