working with package without Namespace in R

Tag: r , namespaces , package , packages Author: A3213211 Date: 2012-04-03

I have got betaversion from website. The only available is windows installation as mybetapackage.zip file. When I installed the package, it does not work when I load it.

> utils:::menuInstallLocal()
> require(mypackage)
Loading required package: mypackage
Failed with error:  ‘package ‘mypackage’ does not have a NAMESPACE and should be re-installed’

Is it possible to use this beta package someway ?

Edits:

I tried the following instructions to create own namespace. Namespace file contains the following:

exportPattern("^[^\\.]")

Now I am getting following warning.

Warning message:
In readLines(file) :
  incomplete final line found on 'C:/Users/user/Documents/R/win-library/2.14/RCropStat/NAMESPACE
You can manually add the namespace in yourself. I remember when this requirement was part of R I asked a question on here about namespaces and they can be added manually. Hadely had written a bit about it. A search here should give you info about adding it; if I recall it's a manipulation to one of the documents in the directories.
Building from source would work. However, if you only have the Windows binary zip, you could try this: click me
Regarding "incomplete final line", if the package loads, I think that warning can be safely ignored. To get rid of it, try adding an additional blank line or two at the end of the NAMESPACE file. I believe the warning is due to a lack of EOL or EOF character at the end of the NAMESPACE file, see here for example: r.789695.n4.nabble.com/…
The readLines warning might just be if the file doesn't end with a blank line. What happens if you add an extra line break at the end of your NAMESPACE file?

Best Answer

Based on the discussion above I am answering my own questions. All credit goes to who discussed this issue.

Create a file with the following text and put an extra line to avoid an error. Same in the directory for the package where you have description file.

exportPattern("^[^\\.]")