Error in As.Double(Y):Cannot Coerce Type 'S4' to Vector of Type 'Double'

Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double'

This problem is caused by library installed incomplete(I guess it might put the wrong name(version) in the pack of arulesViz).

You can download https://cran.rstudio.com/bin/windows/contrib/3.3/seriation_1.2-1.zip manually,then use "r-studio menu -> tools -> install packages.." to install above zip file downloaded from the site.

Then try to redo install.packages("arulesViz") and library(arulesViz), it will be workable.
Done.

R Biogeo pkg: Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double'

line numbers refer to code at https://github.com/cran/biogeo/blob/master/R/pointsworld.R

In lines 37-40 I specified that the functions should be from the sp package (e.g., sp::spatialPoints). Contrary to my previous comment, nothing had to be changed in previous lines. There appears to be something wrong with how the sp functions are being imported (??). I am marking this as answered, even though importing the sp functions is the real issue, but I'm not sure how to fix that at the moment (just need to learn though!).

Question on Plyr error: Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double'

In amongst your confusion about what versions you are running (there wasn't an R version 1.35!!), there are several issues. (To find out what versions of R and packages you are running, try sessionInfo().)

First, the error you are getting comes from your use of text(). It should be statusText().

Second, it seems like some of the functions/methods are not being exported in the package NAMESPACE. You can make it work by specifying the correct namespace when calling the function, as per the example below, but you should email the package maintainer (Jeff Gentry - contact details on CRAN). You can refer to unexported functions using the ::: operator. ::: takes the package/namespace name on the left-hand side, with the function name on the right hand side, e.g.:

twitteR:::statusSource(x)

Here is a full working version of your example:

library(plyr)
library(twitteR)
## simplify the call to see what is going on - function first
fooFun <- function(x) {
data.frame(text = statusText(x), favorited=favorited(x),
created=created(x), truncated=twitteR:::truncated(x),
id=id(x), statusSource=twitteR:::statusSource(x),
screenName=screenName(x))
}
## now ldply it
out <- ldply(searchTwitter("rstats", session = getCurlHandle(), n = 10), fooFun)
## show some of it:
head(out)

Error in as.double(y) : cannot coerce type 'closure' to vector of type 'double' in R

You overwrote the definition of the function y.hat with the statement

y.hat<-y.hat(beta,nhtemp)

I think you want to do something like

y.hat.value <- y.hat(beta,nhtemp)

SparkR - Error in as.double(x) : cannot coerce type 'S4' to vector of type 'double'

You're using Spark 1.5 which doesn't provide more advanced statistical summaries and you cannot use standard R functions when operating on Spark DataFrame. avg() works because it is actually a Spark SQL function available in Spark 1.5.

Additional statistical summaries have been introduced in Spark 1.6 including methods to compute standard deviation (sd, stddev stddev_samp and stddev_pop) and variance (var, variance, var_samp, var_pop). You can of course still compute standard deviation using well known formula as shown in Calculate the standard deviation of grouped data in a Spark DataFrame

why cannot coerce type 'S4' to vector of type 'integer'?

Take a look at How to split and write to a file for S4 object in R . In your case, it appears that Matrix returns an S4 object. Try this:

foo <- Matrix(10,10,10)
slotnames(foo)

That may give a suggestion as to what you want to extract from your tm object.

But why are you using Matrix in the first place? If you just use base::matrix this problem should disappear.
Edit: peeking at the documentation for package Matrix, it's clear that as.integer is not supported. You probably would have to use as(x,matrix) first.



Related Topics



Leave a reply



Submit