[R-pkg-devel] Debian: example file is no longer read correctly
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? 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