Error running the simplest commands

2,511 views
Skip to first unread message

mbac

unread,
May 21, 2014, 3:06:30 AM5/21/14
to sq...@googlegroups.com
Hi,

Sorry if this is elementary, but I couldn’t find any help via search.

When I run the simplest commands in sqldf, I get the following error:

sqldf("SELECT id FROM data WHERE vis_proc_spine LIKE '%epi%’”)
Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'as.labelled' of mode 'function' was not found

I’m using R v. 3.0.2.

I noticed after installing sqldf that using the “install dependencies” option is not recommended in order to avoid potential problems. Could that be the source of the error?

Thanks,

Marco

Gabor Grothendieck

unread,
May 21, 2014, 6:44:03 AM5/21/14
to sq...@googlegroups.com
I have never seen that message in conjuntion with sqldf.  I have seen it result from name conflicts with system functions but more so in older versions of R.

1. Are you running an old version of R by any chance?  Try upgrading to the latest R 3.1.0patched.  Be sure not to upgrade to R 3.1.0 as it had some problems but to R 3.1.0 patched.

2. What is the result of this immediately after getting that error:

   traceback()

3. Can you try starting a vanilla R session and then trying:

   R --vanilla

and then trying:

   library(sqldf)
   sqldf("select * from BOD")

to check whether sqldf runs at all.

brasileir...@gmail.com

unread,
Nov 10, 2015, 5:07:11 PM11/10/15
to sqldf
I fell into the same problem in here. sqldf does not run at all!

I am using R 3.2.2:
( $version.string
[1] "R version 3.2.2 (2015-08-14)")

I ran the following command:
aprduo3 <- sqldf("select * from aprduo2")

And got the following error:

Error in get(as.character(FUN), mode = "function", envir = envir) :
objeto 'as.AsIs' de modo 'function' não foi encontrado

(The second line of the error would mean something like "object 'as.AsIs' of mode 'function' not found)


Any idea would be of great help! Thanks

Gabor Grothendieck

unread,
Nov 10, 2015, 5:32:17 PM11/10/15
to sqldf, brasileir...@gmail.com
Please provide complete examples inlcuding inputs; however, I will take a guess that the problem is that one or more of the columns in your data.frame are of class "AsIs".  When sqldf retrieves the result from SQLite it will be numeric or character and since it was originally of class AsIs it tries to convert it back but R provides no as.AsIs so it fails. If that is the problem then try one of these"

(1) use method = "raw" .  In that case sqldf will not try to conver the results from the database.

     aprduo3 <- sqldf("select * from aprduo2", method = "raw") 
     
or 

(2) it is trying to use the conversion method for AsIs but none exists so define one:

     as.AsIs <- identity
     aprduo3 <- sqldf("select * from aprduo2") 

or

(3) don't use that class in your data frames.
Reply all
Reply to author
Forward
0 new messages