Displaying 20 results from an estimated 2028 matches for "coerceing".
Did you mean:
ceorcing
2008 Apr 09
1
coerce methods and inheritance
Hi,
It doesn't seem that the dispatching algo is finding my coerce method under
some circumstances.
Let's say I have 2 classes, A and AA and that AA is just a direct extension
of A with no additional slots:
setClass("A", representation(ii="integer"))
setClass("AA", contains="A")
I can define a method for coercing my objects to an integer
2012 Jul 30
1
fractal package
Greetings of Peace!
I am new in R software. I want to use the correlation dimension corrDim in computing a map. I have installed the packages(fractal) in R. Now my problem is this, when I tried your example in the following site http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=fractal:corrDim
> library(fractal)
> png(filename="corrDim_%03d_med.png", width=480, height=480)
>
2007 Jul 16
1
S4 coerce
(I am not sure if this is a bug or a request for a more understandable
warning, or possible something obvious I should be posting on r-help.)
I am trying to coerce an new class object to be a DBIConnection and it
does not work the way I think it should:
R version 2.5.1 (2007-06-27) ...
> require("RMySQL") # or require("RSQLite")
Loading required package: RMySQL
Loading
2011 Jan 11
1
how to coerce part of each column of a matrix to a vector and merge them
Hello
Suppose I have a matrix mat=(1:16,2)
[,1] [,2] [,3] [,4]
[1,] 1 5 9 13
[2,] 2 6 10 14
[3,] 3 7 11 15
[4,] 4 8 12 16
there is a vector end=c(2,3,1,3)
#coerce the 1st 2 numbers of the 1st column to a vector [1] 1 2
#coerce the 1st 3 numbers of the 2nd column and append it to the previous vector [1] 1 2 5 6 7
#coerce the 1st number of
2015 Dec 08
2
For integer vectors, `as(x, "numeric")` has no effect.
We do need an explicit method here, I think.
The issue is that as() uses methods for the generic function coerce() but cannot use inheritance in the usual way (if it did, you would be immediately back with no change, since "integer" inherits from "numeric").
Copying in the general method for coercing to "numeric" as an explicit method for "integer" gives
2003 Aug 24
2
setClass question
I would like to add a class to the SparseM package. I have a class "matrix.csr"
that describes a matrix in compressed sparse row format, now I would like a class
matrix.diag.csr that describes such objects when they happen to be diagonal.
The idea is that matrix.diag.csr objects should behave (later in life) exactly like
matrix.csr objects, the distinction is only needed in order to
2004 May 13
0
using trace() on S4 coerce method
I'm trying to use trace() on an S4 coerce method, but get the error
Error in bindingIsLocked(what, whereM) : no binding for "coerce"
What am I doing wrong? Example code follows.
(I've googled the R mailing lists for "trace coerce" and "trace
bindingisLocked" without finding anything relevant. Perhaps I should
re-define the method in terms of an
2008 Oct 14
1
library MICE warning message
Hello.
I have run the command
imp<-mice(mydata, im=c("","pmm","logreg","logreg"),m=5)
for a variable with no missing data, a numeric one and two variables with binary data.
I got the following message:
There were 37 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: In any(predictorMatrix[j, ]) ... : coercing argument of
2004 Jun 14
4
Coercing a dataframe column to datetime
I am trying to coerce a data frame column from character to datetime using strptime but keep getting an error because the length of the coerced object is always 9. What am I doing wrong here:
.................................................................
> ds <- cbind(1:2, c("02/27/92 23:03:20", "02/27/92 22:29:56")); ds
[,1] [,2]
[1,]
2012 Oct 01
1
False positive note about ambiguous dispatch
Hi,
In the situation below the note issued by the dispatch algo doesn't
seem right:
setClass("A", representation(stuff="complex"))
setAs("ANY", "A", function(from) new("A", stuff=as.complex(from)))
> as(6, "A")
An object of class "A"
Slot "stuff":
[1] 6+0i
> as(6L, "A")
2000 Sep 19
3
coerce mode list?
Dear R/S users;
I'm using S+ version 4 Release 3.
and I am trying to do a simple calculation like the
following :
> X1<-X[1:5]
> W1<-W[1:5,1:5]
> X1
[1] 1.250000 1.292308 1.176471 0.937500 1.538462
> W1
VAR00003 VAR00004 VAR00005 VAR00006 VAR00007
1 0 1 0 1 0
2 1 0 0 0 1
3 0 0 0
2006 Jun 05
2
grep() and factors
Hi all,
Based upon an offlist communication this morning, I am somewhat confused
(more than I usually am on most Monday mornings...) about the use of
grep() with factors as the 'x' argument.
The argument guidance in ?grep indicates:
x, text a character vector where matches are sought. Coerced to
character if possible.
and in the Details section:
Arguments which should be
2011 Feb 07
2
as.list(subclassed function) -> cannot coerce type 'closure' to vector of type 'list'
I was looking for all the glm-related 'family' functions
in stats using the following predicate that returns TRUE
for any function whose first argument is called "link".
is.family <- function(object) is.function(object) &&
identical(names(as.list(object))[1], "link")
It threw an error when applied to SSfol
> is.family(SSfol)
Error in
2008 Apr 23
1
S4 default for coercing
Something has changed in the S4 default for coercing. Am I now suppose
to use setAs, or is there something else I should do to make this work:
R version 2.7.0 (2008-04-22)
....
> require("methods")
> setClassUnion("OptionalPOSIXct", c("POSIXct", "NULL"))
[1] "OptionalPOSIXct"
> setClass("TSmetax",
2006 Apr 09
2
type converters not being saved to workspace
Any one can explain why this happens or any work arounds?
> setClass('foo')
[1] "foo"
> setAs('foo', 'character', function(from) from)
> showMethods('coerce')
Function "coerce":
from = "ANY", to = "array"
from = "ANY", to = "call"
from = "ANY", to = "character"
from =
2006 Apr 09
2
type converters not being saved to workspace
Any one can explain why this happens or any work arounds?
> setClass('foo')
[1] "foo"
> setAs('foo', 'character', function(from) from)
> showMethods('coerce')
Function "coerce":
from = "ANY", to = "array"
from = "ANY", to = "call"
from = "ANY", to = "character"
from =
2012 Apr 01
1
Error in xy.coords(x, NULL, log = log) : (list) object cannot be coerced to type 'double'
Hi there,
When I run the code below I get the error
Error in xy.coords(x, NULL, log = log) :(list) object cannot be coerced to
type 'double'
Any tips how I can resolve this?
>
> library("waveslim")
>
> vols=read.csv(file="C:/Users/ocuk/My Documents/Abs Vol.csv", header=TRUE,
> sep=",")
> x<-c(vols[,1])
> #x
> #data(ibm)
>
2010 Mar 31
1
as(1:4, "numeric") versus as.numeric(1:4, "numeric")
Hi,
> class(as(1:4, "numeric"))
[1] "integer"
Surprising but an explanation could be that an integer
vector being a particular case of numeric vector, this
coercion has nothing to do because 1:4 is already numeric.
And indeed:
> is.numeric(1:4)
[1] TRUE
> is.numeric(as(1:4, "numeric"))
[1] TRUE
However, 'as(1:4,
2010 Feb 20
1
coerce (list) object to type 'double'
Dear all,
I am really new to R, and I have problem here. I searched around, but did
not get a solution.
I have a numetrix matrix (20 by 25) saved in .csv. I read it as
>sx<-read.csv("sx.csv",header=F)
Then I try to convert it to numeric using
>sx<-as.numeric(sx)
Error: (list) object cannot be coerced to type 'double'
The class of sx is "data.frame".
I
2008 Aug 27
1
S4 coercion
I am extending a DBI connection by
setClass("TSPostgreSQLConnection",
contains=c("PostgreSQLConnection","TSdbOptions"))
but the first time I use this I am getting a warning when it tries to
coerce the TSPostgreSQLConnection to a PostgreSQLConnection. After the
first use the warning stops, but the first warning is causing me
problems when I do automatic checks