working with package without Namespace in R - r

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

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("^[^\\.]")

Related

Facing issue with R package Phyloseq

Since i have removed phyloseq package from my RStudio. Every time when i am running any code the below lines are coming again and again and halting my codes. This below lines coming again and again in console whenever i am opening the RStudio. Don't know how to deal with this problem. Please help me to solve this problem. I am also attaching a picture which will show my problem properly.
Loading required package: phyloseq
Error in .requirePackage(package) :
unable to find required package ‘phyloseq’
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘phyloseq’
Thanks & Regards
Rishikesh
I haven't tried anything yet to solve this problem. But one person telling me this problem arises due to dependency packages of phyloseq. Please help me to solve this problem.
It is not a package dependency issue, looks like you have somehow added this package as a start-up required to your .Rprofile file.
locate your .Rprofile file (you might have several, the default should be located at your home directory ~/.Rprofile on MacOS/Linux), open it with a text editor and remove the line with phyloseq (could be like library(phyloseq).
If you couldn't find the file or edit it for any reason, the easiest solution could be just reinstalling the package, that would probably do the job for you as well.

"object not found" during package build/install

I'm at a loss to debug building/installing a package. Building a package "MyProjekt" through
> devtools::build("MyProjekt")
works fine, even though
> devtools::document()
Updating MyProjekt documentation
Loading MyProjekt
Error: object 'rank' not found whilst loading namespace 'MyProjekt'
fails.
Attempting to install the built (pure R) package
> install.packages(pkgs="./MyProjekt.tar.gz")
...
Error: package or namespace load failed for 'MyProjekt':
object 'rank' not found whilst loading namespace 'MyProjekt'
Error: loading failed
Execution halted
...
ERROR: loading failed for 'i386', 'x64'
also fails.
Unfortunately the term 'rank' is a common term in my domain and I have hundreds of hits when searching in my files for that term.
How might I start a systematic way to hunt this bug down?
The toolchain mistakenly generates S3method(...) in the NAMESPACE file.
Follow this answer and edit the NAMESPACE file by hand. Replace occurrences of S3method(f) with export(f).
I'm not certain this is repeatable. The generated files appear to be not just written, but also read during a subsequent package build (by devtools? by roxygen2?). Add your comments if this works/does not work for you.

How to properly use Fortran shared object in R package

I'm writing an R package with the help of devtools.
I have a R function which uses Fortran subroutines (called with .Fortran() function) from a packagename.so file located in the src folder.
I put #useDynLib packagename in R/packagename.R and ran devtools::document() to add useDynLib(packagename) to NAMESPACE but when I run devtools::check() an error occures.
I read the R packages documentation and googled the question but I haven't found a solution yet.
Two related questions come to my mind:
do I need the Fortran source code and let R compile it?
should the shared object have the same name of the package or not?
TL;DR
How do I get rid of the following error after running devtools::check()?
Error: package or namespace load failed for ‘ROCkerMeth’ in library.dynam(lib, package, package.lib):
shared object ‘ROCkerMeth.so’ not found

Pandoc not recognized as R library

I installed Pandoc manually through this installation - link.
After restarting the system, I was able to locate the installation folder at C:/Users/YourUserName/AppData/Local/Pandoc
But when I'm trying to call the library:
library("pandoc", lib.loc = "C:/Users/YourUserName/AppData/Local/Pandoc")
I'm getting the following error:
Error in library("pandoc", lib.loc = "C:/Users/YourUserName/AppData/Local/Pandoc") :
no library trees found in 'lib.loc'
As i'm behind a firewall, I cannot install pandoc through github. So the install.pandoc() function is out.
Any ideas where I'm getting the installation process wrong?
Edit:
I've changed .LibPath to point to Pandoc's installation folder:
.libPaths('C:/Users/stefanj/AppData/Local/Pandoc')
And if I check, it seems to be ok:
> grep("pandoc", list.files(.libPaths()))
[1] 22 24
library(pandoc)
Error in library(pandoc) : there is no package called ‘pandoc’
Execution halted
I agree to #Dason's point that library in path : "C:/Users/YourUserName/AppData/Local/Pandoc" is not any library/package connected with R. It's just pandoc installed.
Other way to install pandoc would be using installr :
installr::install.pandoc()
Now, for performing for converting from one markup format to another, use the following package :
rmarkdown
The rmarkdown package includes high level functions for converting to a variety of formats. For
example:
render("input.Rmd", html_document())
render("input.Rmd", pdf_document())
Hope this helps.

install_github install package but I can't call the functions

I can see my package is installed with library(), but when I load the package from the library, I can't call any of the functions.
> install_github("pdfHarvester", "hansthompson")
> library(pdfHarvester)
> Convert
Error: object 'Convert' not found
> Parse_Tables
Error: object 'Convert' not found
You need to make sure you package actually exports the functions you want to use. This is a package development issue - not an issue with install_github.
Note that your NAMESPACE file is empty: https://github.com/hansthompson/pdfHarvester/blob/master/NAMESPACE
It looks like you're using roxygen for your .R files. If you're using devtools for the package creation you need to use document() to generate your help file and populate the NAMESPACE file.

Resources