[R-pkg-devel] Debian: example file is no longer read correctly

Göran Broström goran.brostrom at umu.se
Wed Dec 20 14:02:59 CET 2017


On 2017-12-20 12:14, Göran Broström wrote:
> Christine,
> 
> the error message from CRAN/r-devel-linux suggests that the error comes 
> from your function nparACT_flex_loop . There your code below is embedded
> in a loop:
> 
> for (zz in 1:nofiles) ....
> 
> If nofiles == 0 (no found files), this loop is still executed (R is not 
> Fortran). Maybe this is the cause of the failure?

No, it is not. But when I ran R CMD check --as-cran ..., a file 
'nparACT-Ex.timings' was created in 
'nparACT.Rcheck/sleepstudy_example/', which your example reads, and 
disaster follows.

R CMD check (without --as-cran) avoids this problem, but CRAN will not 
accept it. Seems to be the writing to and reading from disc that is 
problematic and in need of some structure? Others may help with that.

Göran

> 
> You should anyway use seq_len(nofiles) or seq_along(files) instead of 
> 1:nofiles, or check the  number of files found.
> 
> Göran
> 
> On 2017-12-20 11:11, Blume Christine wrote:
>> Dear all,
>>
>> I guess I need your help again. With debian my package (nparACT) gives 
>> an error message that seems to be related to loading the data:
>>
>>   Warning in is.na(data$activity) :
>>       is.na() applied to non-(list or vector) of type 'NULL'
>>      Error in 1:a : argument of length 0
>>
>> Although I have set up a virtual machine to test the package using the 
>> R devel version with Linux (Debian), it gives me a hard time to find 
>> out what is wrong since I do not manage to install packages using the 
>> devel version...
>>
>> Does anyone know what has changed so this text file is not read in any 
>> longer? The code for reading in the text file is:
>>
>> data <- read.table(paste(path,name, sep="/"), header = F)
>>      if (is.data.frame(data)==F){
>>        data = as.data.frame(data)
>>      }
>>      if(ncol(data) == 2){
>>        data[,1] <- as.POSIXct(data[,1])
>>        data[,2] <- as.numeric(as.character(data[,2]))
>>        names(data)[1] <- "time"
>>        names(data)[2] <- "activity"
>>     }
>>      if(ncol(data) == 3){
>>        names(data)[1] <- "date"
>>        names(data)[2] <- "time"
>>        names(data)[3] <- "activity"
>>        data$date <- NULL
>>        data$time <- as.POSIXct(data$time, format="%H:%M:%S")
>>        data$activity <- as.numeric(as.character(data$activity))
>>      }
>>
>> Or can someone tell me how to install the package using R devel on Linux?
>>
>> Thanks a lot!
>> Christine
>>
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
> 
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list