1

Can someone explain to me what this error means? I'm new to programming so if you can explain it in the most elementary cs terms I would very much appreciate it.

I get this error message from R Studio when trying to process other code from time to time, but I'll give the most current example:

In this case, I'm trying to find out what functions are in the jpeg package

 ls(jpeg())

and im getting this error in return:

Error in as.environment(pos) : using 'as.environment(NULL)' is defunct
  • I find that when I use the following below code to find the package, it works. but why does it work? what is the difference between creating a function and just using the list function? lsp <- function(package, all.names = FALSE, pattern) { package <- deparse(substitute(package)) ls( pos = paste("package", package, sep = ":"), all.names = all.names, pattern = pattern ) } lsp() – Just_trying_to_get_by Jan 29 '17 at 23:52
  • `jpeg()` is a function, not a package. And if called without arguments, it returns `NULL`. So, `ls(jpeg())` is the same as `ls(NULL)`, which gives an error. If you want to list all the functions in the jpeg package, you should use `ls("package:jpeg")`. The function `lsp` works, because if given `jpeg` as input, it will call `ls(pos = "package:jpeg")`. – Stibu Jan 30 '17 at 20:45
  • And another remark regarding your comment: if you have something to add to your question, it would be much better to edit the question instead of adding a comment. You can click on "edit" just underneath the question to do so. – Stibu Jan 30 '17 at 20:47

0 Answers0