[R-SIG-Mac] package.skeleton

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jun 15 14:37:48 CEST 2014


On 15/06/2014, 8:23 AM, Paul Ossenbruggen wrote:
> 	I have developed a R script that works perfectly. Since it is long and complicated, I want to create a R package and share it with my team members. With one exception of the function ’TrafficData,’ all functions of the package version of my script works fine. 
> 
>> datasets = TrafficData()
> Error in as.numeric(q) : 
>   cannot coerce type 'builtin' to vector of type  ‘double'

Use traceback() to find where this error occurred.  If it was in the K()
function, then the argument passed as q is probably not what you think
it was, it was likely the built-in function q() that causes R to quit.

> 
> I have checked all functions of my script where `q` is called in ’TrafficData.' They all work fine. For example, TrafficData calls the functions ‘K’, ‘phi.X.’ and ‘qk.’ ‘K’ is only one that requires ‘q.’
> 
>> K
> function (q, x) 
> {
>     kjam = as.numeric(kjam)
>     kstar = as.numeric(kstar)
>     qstar = as.numeric(qstar)
>     x = as.numeric(x)
>     q = as.numeric(q)
>     m = qstar/(kjam - kstar)
>     kf = (kstar/qstar) * q
>     kc = (m * kjam - q)/m
>     if (x == 1) 
>         k = kc
>     else k = kf
>     return(k)
> }
> <environment: namespace:traffic>
>> K(3.2,1)
> [1] 0.4207143

In this case it worked, because q was 3.2.

Duncan Murdoch

> 
> 	As I was developing the script, I found that I needed ‘as.numeric' command. I use it throughout the script. Removing ‘q = as.numeric(q)’ from ‘K’ gives the same Error message. 
> 
> 	I am a novice with package.skeleton. I am unsure how to find the bug. Any suggestions will be greatly appreciated.
> 
> Thanks,
> Paul
> 
> 	To be thorough, I provide the following Warnings. I don’t believe they are connected to the above Error. Suggestions for eliminating these warnings are also welcome. Incidentally, I did not provide an Example.
> 
> * checking whether package ‘traffic’ can be installed ... WARNING
> Found the following significant warnings:
>   Warning: /Users/PJO/traffic/man/traffic-package.Rd:29: All text must be in a section
>   Warning: /Users/PJO/traffic/man/traffic-package.Rd:30: All text must be in a section
> * checking DESCRIPTION meta-information ... WARNING
> Non-standard license specification:
>   What license is it under?
> * checking Rd cross-references ... WARNING
> Unknown package ‘<pkg>’ in Rd xrefs
> * checking for code/documentation mismatches ... WARNING
> Data with usage in documentation object 'C' but not in code:
>   C
> * checking data for ASCII and uncompressed saves ... WARNING
>   
>   Note: significantly better compression could be obtained
>         by using R CMD build --resave-data
>                old_size new_size compress
>   datasets.rda    150Kb     76Kb       xz
>   df.plot.rda      57Kb     29Kb       xz
>   df.plot1.rda     70Kb     35Kb       xz
>   df.rda           20Kb     10Kb       xz
>   output.rda       36Kb     23Kb    bzip2
>   runs.rda         34Kb     22Kb    bzip2
> * checking examples ... ERROR
> Running examples in ‘traffic-Ex.R’ failed
> The error most likely occurred in:
> 
>> ### Name: traffic-package
>> ### Title: traffic package
>> ### Aliases: traffic-package traffic
>> ### Keywords: package
> 	[[alternative HTML version deleted]]
> 
> 
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>



More information about the R-SIG-Mac mailing list