Comments (5)
I found the reason for this strange behavior. I had one function saved as (in file date.R):
print.date <- function(x, sep = '-')
Without {}
or NULL
. It seems that if there is no separator after the function (NULL
or {}
) then the interpreter will generate difficult to detect errors. I've seen similar problems on the internet and people have trouble determining what causes these errors.
Should I close this application or leave it open. Maybe it's worth adding some checks in the parser?
from pqr.
Was that function with no body the last thing in the date.R file? If not, the following text will be parsed as the body of the function (which is perfectly normal - many functions are defined with the body following function (...) without a { on the same line.
When I try parsing a file with an incomplete function definition at the end, I get "unexpected end of input", both with pqR and with R-3.5.1. But you didn't see such an error? Perhaps it gets generated but then ignored (and not displayed) in the package installation process. If that seems to be the problem, it would help if you posted a tar file of a complete package directory that behaves badly when trying to install.
from pqr.
Here you go:
# cat radford.sh
#!/bin/sh
mkdir -p /tmp/x/R
cat <<EOF > /tmp/x/R/1.R
f1 <- function(x) {}
f2 <- function(x)
EOF
cat <<EOF > /tmp/x/R/2.R
f3 <- function(x) {}
EOF
cat <<EOF > /tmp/x/NAMESPACE
export(f1,f2,f3)
EOF
cat <<EOF > /tmp/x/DESCRIPTION
Package: xxx
Type: Package
Title: x
Version: 0.1
Date: 2019-03-31
Author: x
Depends:
Suggests:
Maintainer: x <[email protected]>
Description:
LazyLoad: yes
License: MIT
EOF
cd /tmp
R CMD INSTALL x
#
# sh radford.sh
* installing to library ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library’
* installing *source* package ‘xxx’ ...
** R
** preparing package for lazy loading
** help
No man pages found in package ‘xxx’
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) : undefined exports: f3
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/xxx’
from pqr.
I think I know what's happening. A clue is that the error message refers to f3, not to f2, which is the function that's missing its body. I think all the .R files are concatenated into one .R file, and then parsed. When this is done, there's no error in the definition of f2, since after concatenating files, it's definition becomes
f2 <- function (x)
f3 <- function (x) {}
This defines a function f2 that returns a function as its value, namely the function function(x){}. There is no global definition for f3, since the assignment to f3 is as a local variable of f2.
There's no obvious simple fix. Perhaps package installation should not concatenate source files. Or perhaps there should be a parser directive (a special comment, like #line at present) that signals an error if it is found inside a syntactic construct, which could be included between concatenated files to signal an error in situations like this.
Of course, the nature of the problem will change with the names of the source files, since they determine the order in which the files are concatenated.
from pqr.
Exactly. This was a very strange error message because I knew that the functions indicated in the error were correct. I'm working on a new datetime class. Unfortunately, I'm not satisfied with R's Date and POSIXct.
btw. if you would be interested in refactoring the C code in pqR, I can get involved. The readability would improve and it would be easier to detect errors. #36 (comment)
from pqr.
Related Issues (20)
- What is preventing the merge of pqR into R? HOT 1
- pqR side by side with GNU-R HOT 8
- T and F don't work with mat_mult_with_BLAS configuration argument
- Docker image for pqR HOT 3
- No window version available HOT 1
- Incompatible library version HOT 3
- Will pqR code be merged to R? HOT 9
- Missing <R_ext/sggc-app.h> HOT 11
- Proposal of new feature: native 64 bit integers support HOT 2
- Update formula does not work as expected HOT 6
- make error: multiple definitions HOT 6
- segfault when using attributes HOT 1
- buffer overflow when using attributes on a recursive function HOT 2
- floating point exception
- pqR aborted when using plot
- Problems with installation ubuntu 20.04 HOT 5
- Pqr and running Rstudio on mac
- Installation fails on Slackware 15.0 HOT 13
- Slow pqR loops vs R (CRAN)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pqr.