Displaying 20 results from an estimated 6000 matches similar to: "unwanted coercion using apply"
2003 Feb 27
0
unwanted coercion of length 0 vectors (PR#2587)
When something is assigned to an element of a vector that was previously of
length 0, the vector is coerced to the mode of the something, regardless of
whether the coercion is necessary under normal R rules.
In particular, if NA is assigned to an element of a vector that was
previously length 0, the mode of the vector is coerced to 'logical'.
For example, here's the normal behaviour:
2015 Mar 28
2
[LLVMdev] LLVMContextImpl.h not installed?
Hi all,
I 'd like to fetch a list of structures, and found that it could be done
via
LLVMContextImpl *pImpl = Context.pImpl;
pImpl->AnonStructTypes
This however needs the inclusion of LLVMContextImpl.h, which is not
contained in the includes dir, but in the lib/IR dir (next to the .cpp
files) and is not installed under /usr/local/include...
Whats the reason for this? Isn't it
2008 Feb 08
1
unwanted paragraph (syntax edge-case)
Hi list!
Take this markdown input:
* asdf
* asdf
* asdf
asdf
What I want:
<ul>
<li>asdf
<ul>
<li>asdf</li>
<li>asdf</li>
</ul>
<p>asdf</p></li>
</ul>
But markdown puts the first asdf into a paragraph. There is nothing I can do
2005 Feb 24
4
r: functions
hi all
i have a function that uses two inputs, say xdata and ydata. An example
is the following,
simple1<-function(xdata,ydata)
{
ofit<-lm(ydata~xdata)
list(ofit)
}
say i use arbitray number for xdata and ydata such that
D =
x1 x2 y
1 1 10
2 6 6
3 10 7
x<-D[,1:2]
and
y<-D[,3]
if one uses these inputs and rund the program we get the following:
>simple(xdata=x,ydata=y)
2020 Oct 07
2
Coercion function does not work for the ALTREP object
Hi all,
The coercion function defined for the ALTREP object will not be called by R
when an assignment operation implicitly introduces coercion for a large
ALTREP object.
For example, If I create a vector of length 10, the ALTREP coercion
function seems to work fine.
```
> x <- 1:10
> y <- wrap_altrep(x)
> .Internal(inspect(y))
@0x000000001f9271c0 13 INTSXP g0c0 [REF(2)] I am
2016 Oct 12
2
How to assign NULL value to pairlist element while keeping it a pairlist?
Hi Henrik,
It would help to understand your use case for pairlists.
Thanks,
Michael
On Wed, Oct 12, 2016 at 9:40 AM, Michael Lawrence <michafla at gene.com> wrote:
> The coercion is probably the most viable workaround for now, as it's
> consistent with what happens internally for calls. All pairlists/calls
> are converted to list for subassignment, but only calls are
2016 Oct 12
2
How to assign NULL value to pairlist element while keeping it a pairlist?
Hi, I seem to not be able to assign NULL to an element of a pairlist
without causing it to be coerced to a plain list. For example:
> x <- pairlist(1, 2)
> class(x)
[1] "pairlist"
> x[1] <- list(NULL)
> class(x)
[1] "list"
This actually true for all [()<- assignments regardless of list value, e.g.
> x <- pairlist(1, 2)
> x[1] <- list(0)
[1]
2012 Aug 28
3
date in plot, can't add regression line
Hello all,
I have been using R for about 3 weeks and I am frustrated by a problem. I have read R in a nutshell, scoured the internet for help but I either am not understanding examples or am missing something completely basic. Here is the problem:
I want to plot data that contains dates on the x axis. Then I want to fit a line to the data. I have been unable to do it.
This is an example of
2008 Jun 24
2
persp plot
I have a set of data in the form
x1, y1, z1
x1, y2, z2
...
x1, yN, zN
x2, y1, z(N+1)
x2, y2, z(N+2)
...
x2, yN, z(2N)
...and so on...
xM, yN, val(M*N)
I have been trying to figure out how to get R to use this data in a
persp plot. So far the only thing that I can figure out to do is to
break the data file into three different files. The first file
contains the x-coordinate data:
x1
x2
2016 Oct 12
2
How to assign NULL value to pairlist element while keeping it a pairlist?
Thanks, this was what I expected. There is a desire to eliminate the
usage of pairlist from user code, which suggests the alternative of
allowing for function arguments to be stored in lists. That's a much
deeper change though.
On Wed, Oct 12, 2016 at 12:31 PM, Henrik Bengtsson
<henrik.bengtsson at gmail.com> wrote:
> Michael, thanks for this info.
>
> I've stumbled upon
2020 Oct 08
1
Coercion function does not work for the ALTREP object
Hi Gabriel, here is a simple package for reproducing the problem.
https://github.com/Jiefei-Wang/testPkg
Best,
Jiefei
On Thu, Oct 8, 2020 at 5:04 AM Gabriel Becker <gabembecker at gmail.com> wrote:
> Jiefei,
>
> Where does the code for your altrep class live?
>
> Thanks,
> ~G
>
> On Wed, Oct 7, 2020 at 4:25 AM Jiefei Wang <szwjf08 at gmail.com> wrote:
>
2020 Nov 21
3
Two ALTREP questions
Hello,
I have two related ALTREP questions. It seems like there is no way to
assign attributes to an ALTREP vector without using C++ code. To be more
specifically, I want to make an ALTREP matrix, I have tried the following R
code but none of them work.
```
.Internal(inspect(1:6))
.Internal(inspect(matrix(1:6, 2,3)))
.Internal(inspect(as.matrix(1:6)))
.Internal(inspect(structure(1:6, dim =
2016 Oct 19
2
How to assign NULL value to pairlist element while keeping it a pairlist?
On Sat, Oct 15, 2016 at 2:00 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> Michael Lawrence <lawrence.michael at gene.com>
>>>>>> on Wed, 12 Oct 2016 15:21:13 -0700 writes:
>
> > Thanks, this was what I expected. There is a desire to
> > eliminate the usage of pairlist from user code, which
> >
2004 Nov 26
1
Namespaces, coercion and setAs
I'm trying to resolve a small problem that has arisen from introducing a
NAMESPACE for the package SparseM. Prior to the namespace I had
a class "matrix.diag.csr" that consisted of diagonal sparse matrices.
It
was defined to have the same attributes as the matrix.csr class and
setAs
was used to define how to coerce integers and vectors into this form:
2003 May 05
1
segfault when applying strange coercion (PR#2923)
I made a mistake -- and R crashed. A (more or less) reproducible example
seems to be:
x <- matrix(nrow=20000, ncol=20)
x$any <- numeric(0)
It is possible to crash R by executing these lines several times (1 -
20) on Windows as well as on Solaris (might be related to PR#2880 -
let's call it "non-existing list elements")
Uwe Ligges
--please do not edit the
2008 Sep 15
2
S4 coercion responsibility
Should functions or the user be responsible for coercing an S4 object
argument containing the proper object (and thus should below be
considered a bug in the packages or not)?
The example is with RSQLite but the same thing happens with RMySQL, and
other DBI packages.
> library("RSQLite") Loading required package: DBI
> m <- dbDriver("SQLite")
> con <-
2008 Jul 25
3
Bug in gap.plot
Hi, all
I am trying to make a plot with a axis break and I want the whole plot
to be line, not points. However, when I execute the following command
half of the graph is points and the other lines.
gap.plot(Xdata, Ydata,gap=c(5,6),gap.axis="x",type="l")
I think it might be a bug in plotrix. I would greatly appreciate your
input. If there is another way to do it, I
2007 Jun 01
1
object not found inside function
Hi!
When running the following code I get the message: Error in eval(expr,
envir, enclos) : object "A" not found
fm <- function(p,ydata, env = parent.frame()) {
#fit model y ~ (b0+b1x1+...+bpxp)*exp(g2plus*z2plus) where bi and g2plus
are parameters
#create design matrix for linear part
fo00 <-
2024 Jul 05
2
API for converting LANGSXP to LISTSXP?
Hi,
A common idiom in the R sources is to convert objects between LANGSXP
and LISTSXP by using SET_TYPEOF. However, this is soon going to be
disallowed in packages. From what I can see, there isn't currently a
direct way to convert between these two object types using the
available API. At the R level, one can convert calls to pairlists
with:
>
2006 Nov 14
1
??: Re: Need help in waveslim package: imodwt and universal.thresh.modwt
Airon,
I used R2.4.0 on a Windows XP (SP2) (not Chinese :-))
and it still works:
> data = read.csv("u:/airon.csv")
> xdata = data$Adj..Close
> modwt.la8 = modwt(xdata, "la8", n.level=6)
> summary(modwt.la8)
Length Class Mode
d1 1467 -none- numeric
d2 1467 -none- numeric
d3 1467 -none- numeric
d4 1467 -none- numeric
d5 1467 -none- numeric
d6 1467