Unexpected input while testing packages

When testing a function for a package, I got this .out

* installing *source* package 'trib' ...
** R
Error in parse(outFile) : 
C:R/trib.Rcheck/00_pkg_src/trib/R/tribF.R:48:27: unexpected input
47: 
48:     CF[i]<-mean(All[[i]]$μ
                          ^
ERROR: unable to collate and parse R files for package 'trib'

      

The task is represented by the symbol μ (mu). All my files are there and I can use these functions. I would also like to use this feature in a package so that my colleagues can use the csv files.

Function below

trib.CoF <- function(x) { #gets file name length input returns coeficient of friction in bar plot generates global var CF

namesAll<-trib.names(x)
CF <<- vector(mode = "numeric")     #generate vector for values
for (i in 1:l_All){

CF[i]<-mean(All[[i]]$μ)}             #get all coefficient of friction data into CF

names(CF)<-namesAll
barplot(CF,main="Average Friction Coefficient",
      xlab="Samples",ylab="μ",xlim=c(0,length(CF)*1.25+1), ylim = c(0,1.2*max(CF)),col=c(1:l_All))    #generate bar plot
legend("topright", legend=signif(CF,6),col=c(1:l_All),pch=16,cex=0.8)                                 #add legends

}

      

It looks like this question , but I can't seem to find a solution.

+3


source to share


1 answer


I found a solution to my question. This is rather a workaround, but depends on the structure of the table. Think my table as such

Time    Distance     Laps      µ          FrictionForce
0,100   0           0,00000   0,18478       0,55435

      

μ is the fourth column. So instead of using that name μ, I just use its number. I will change

CF[i]<-mean(All[[i]]$μ)}             #get all coefficient of friction data into CF

      



from

CF[i]<-mean(All[[i]][[4]])} #get all coefficient of friction data into CF

      

This removes the ASCII character error so I can compile it as a package. I might have to write a table validation function for the input structure, but describing it manually and providing a dataset should be enough.

+2


source







All Articles