similar to: data.matrix returns mode logical for zero rows (PR#8496)

Displaying 20 results from an estimated 10000 matches similar to: "data.matrix returns mode logical for zero rows (PR#8496)"

2004 Apr 20
2
Re: [R] Unexpected behaviour of identical (PR#6799)
"Swinton, Jonathan" <Jonathan.Swinton@astrazeneca.com> writes: > # works as expected > > ac <- c('A','B'); > > identical(ac,ac[1:2]) > [1] TRUE > > #but > > af <- factor(ac) > > identical(af,af[1:2]) > [1] FALSE > > Any opinions? Did a cross-check with Splus and it doesn't do that , so I think it
2004 Apr 19
3
How to write an S4 method for sum or a Summary generic
If I have a class Foo, then i can write an S3 method for sum for it: >setClass("Foo",representation(a="integer"));aFoo=new("Foo",a=c(1:3,NA)) >sum.Foo <- function(x,na.rm){print(x);print(na.rm);sum(x at a,na.rm=na.rm)} >sum(aFoo) But how do I write an S4 method for this? All my attempts to do so have foundered. For example
2003 Dec 19
1
Missing arguments to new
Is this the expected and/or correct behaviour? And if so, how do I persuade new to interpret a named but missing argument as missing? ------------- setClass("testMissing",representation(a="numeric"),prototype=list(a=0)); showMissing <- function(real.arg,missing.arg) { really.missing <- new("testMissing"); show(really.missing); really.there <-
2008 Apr 16
1
segments() with zero-length arguments (PR#11192)
Uwe Ligges suggested I post this on R-bugs as a wishlist item with a proposed patch. R considers zero-length arguments to segments() to be an error. I would like R to allow this and to return without an error. It occurs naturally in settings like valid <- c(FALSE, FALSE, FALSE) segments(x0[valid], y0[valid], x1[valid], y1[valid]) For what it may be worth, S-Plus does not consider
2004 Feb 10
4
The ttest.c example in R under MS Windows
We are trying to compile and run the ttest.c example that comes with R (in C:\Program Files\R\rw1081\src\library\windlgs\src\ttest.c). After compiling it with MS Visual C++ we load the DLL with dyn.load. So far it seems good, but when we try to call it from R (after running C:\Program Files\R\rw1081\src\library\windlgs\R\windlgs.R) R crashes. We have tried changing the exports from DLL but have
2001 Feb 07
5
zero inflated poisson and censored-continuous models
I wonder if there is a package that will estimate a Zero Inflated Poisson Model (ZIP), and also if there is a package that will estimate what is called the Tobit model: that is a combination of censored and observed values in the same sample. Georgina Bermann Biostatistics AstraZeneca R&D M?lndal -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing
2003 Dec 18
1
qbinom when probability is 1 (PR#5900)
Full_Name: Jonathan Swinton Version: 1.8.0 OS: Windows 2000 Submission from: (NULL) (193.132.159.34) Calling qbinom with a sample probability of 1 returns NaN > qbinom(p=0.95,size=10,prob=1) [1] NaN I believe that this is wrong and that qbinom(p,size,prob=1) should always be size for 0<p<=1. The documentation says that The quantile is defined as the smallest value x such that F(x)
2013 Apr 18
1
select and do some calculations/manipulations on certain rows based on conditions in R
Hi, May be this helps (Assuming that there are only '0's and '1's in the dataset) dat1<-read.table(text=" ??????? ID X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 1?? 5184??? 0??? 0??? 0??? 0??? 0?? 0?? 0??? 0??? 0??? 1???? 0????? 0????? 0????? 0????? 0????? 0 2?? 6884??? 0??? 0??? 1??? 0??? 0?? 1?? 0??? 0??? 0??? 0???? 0????? 0????? 0????? 0????? 0????? 0 3?
2003 Apr 01
2
Old style and new style classes
I have been writing quick and dirty S-plus code for years, but for a recent project I took the plunge, bought Venables and Ripley's S Programming, and implemented a class library using new style classes (in S-Plus 6.0). It worked quite nicely and I am wondering about making more routine use of them. Before I make much more of an investment, I have a few questions, both factual and subjective,
2003 Apr 01
2
Old style and new style classes
I have been writing quick and dirty S-plus code for years, but for a recent project I took the plunge, bought Venables and Ripley's S Programming, and implemented a class library using new style classes (in S-Plus 6.0). It worked quite nicely and I am wondering about making more routine use of them. Before I make much more of an investment, I have a few questions, both factual and subjective,
2017 Sep 19
1
symbolic computing example with Ryacas
Thanks for the response. Yes, I did study the vignette but did not understand it fully. Anyway, I have tried once again now. I am happy to say that I have got what I wanted. library(Ryacas) x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C") my_func <- function(x,U,x0,C) { return (U/(1+exp(-(x-x0)/C)))} FirstDeriv <-
2017 Sep 19
2
symbolic computing example with Ryacas
Hi all, I am trying to implement the following matlab code with Ryacas : syms U x x0 C d1=diff(U/(1+exp(-(x-x0)/C)),x); pretty(d1) d2=diff(U/(1+exp(-(x-x0)/C)),x,2); pretty(d2) solx2 = solve(d2 == 0, x, 'Real', true) pretty(solx2) slope2=subs(d1,solx2) I have tried the following : library(Ryacas) x <- Sym("x");U <- Sym("U");x0 <-
2009 Jun 19
1
Drawing dendrogram
Dear all, I would like to draw a dendrogram and mark some parts/branches (by using "segments") including their labels. If I draw it without specifying the length of x axix, I am able to do that (as in My dendrogram 1 of the following codes). However, if I want to specify the x axix, I am not able to draw marking line (by using "segments") including labels (as in My dendrogram
2018 Sep 07
2
Construir matriz de distancias
Me encantaría saber pensar así de una. Creo que entiendo bien lo que me decís, pero no lo puedo poner en marcha en mi computadora, por algo que no sé qué será. Cuando llego a: > cosa<-aline(w1=x,w2=y) En RStudio me dice que R sufrió algo. Probé directamente desde la consola linux y también: > cosa<-aline(w1=x,w2=y) *** stack smashing detected ***: /usr/lib/R/bin/exec/R terminated
2017 Sep 19
0
symbolic computing example with Ryacas
Have you studied the "Introduction to Ryacas" vignette that come with the package? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Sep 19, 2017 at 2:37 AM, Vivek Sutradhara <viveksutra at gmail.com> wrote:
2012 Mar 09
1
extracting the i-th row of a matrix in a list of lists
Hi, what is the proper of of "passing a missing value" so I can extract the entire i-th row of a matrix (in a list of lists) without pre-computing the number of cols? For example, if I know that the matrices have 2 columns, I can do the following: set.seed(1) x0 <- lapply(1:10, function(i) replicate(4, list(matrix(rnorm(10), nc=2)))) lapply(lapply(x0, '[[', 3), '[',
2010 Jul 20
3
simplify if statement in R ?
I found a form of the if statement that works but it is very long. I'm attempting to check the value of of two different variables to see if they evaluate to either of two different values, which will result in a division by 0 in the final equation. This first if statement works for me _______ if ((x0.trial01 == 0.0)||(x0.trial01 == npt01)||(x1.trial01 == 0.0)||(x1.trial01 == npt01))
2014 Dec 04
2
[LLVMdev] Optimising bit-flipping code
Hi, I'm compiling a large code base that uses tagged data, with the tag in the two lowest bits. I.e. ints are shifted two steps to the left and have 2 in the tag bits, pointers have 0 in the tag bits, etc. When I compile the code, I notice that there are places where -O3 doesn't remove unnecessary tag bit tests and manipulations, when they are performed with bitwise manipulation (which
2006 Mar 28
2
R 2.3.0 (alpha) on FreeBSD 6.1 fails make check-all
Hi Developers, The alpha, compiles successfully, but it is failing make check-all (on two seperate machines, both FreeBSD 6.1). Here is the version string: platform i386-unknown-freebsd6.1 arch i386 os freebsd6.1 system i386, freebsd6.1 status alpha major 2 minor 3.0 year 2006 month 03 day 27 svn rev
2015 Jan 15
2
[LLVMdev] generate llvm.assume calls in GVN?
Would it be wrong to generate the llvm.assume IR suggested below? in GVN? Given more info via the AssumptionCache, InstCombine can then do more optimizing. On Thu, Dec 4, 2014 at 12:10 PM, Philip Reames <listmail at philipreames.com> wrote: > > On 12/04/2014 02:19 AM, Lars Rasmusson SICS wrote: > > Hi, > > I'm compiling a large code base that uses tagged data, with