coerce type 'S4' to vector ot type 'double'

I am new to r code so getting some issue here is the code

%r library(sparkr)

test1 <- "select t.result from usertest l join userlab t on t.uid=l.uid where t.result is not null;"
test2 <- "select t.result from usertest2 l join userlab2 t on t.uid=l.uid where t.result is not null"

tq <- sql(test1) tm <- sql(test2)

tqn <- as.numeric(tq)
tmn <- as.numeric(tm)

wilconx.text(t1n, tmn, paired=FALSE, correct=FALSE)

error message: cannot coerce type 'S4' to vector type 'double'

please guide.


It seems you have some typos in the above command. I assume t1n should be tqn and the test is named wilcox.test. If those are correct in your code, please post the results of running





it is typo, my apology

wilconx.text(tqn, tmn, paired=FALSE, correct=FALSE)

i still do that same message about [coerce type 'S4' to vector ot type 'double'

the query doe return with data life bellow:

test1 = 95.00, 105.000, 98.00
test2 = 102.00, 108.0000,96.00

i ran the query in sql works fine so data is there,

not sure what wrong being done.


Please post the results of each of the following lines of code.





i tried running class(tqn) and class(tmn) getting same message as as.numeric(tqn): cannot coerce type 'S4' to vector type 'double'


But when you ran class(tqn) what was the output of that specific line or code?

Let me explain why I want to know the result of class(tqn) and class(tmn). The wlicox.test() is complaining that one or the other is not numeric. The class() function will reveal whether either of them is numeric. It may be that the as.numeric() function is not doing what you expect.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.