WavX / bioacoustics

bioacoustics package: detect and extract automatically acoustic features in audio recordings
44 stars 13 forks source link

Error: $ operator is invalid for atomic vectors ...... Ubuntu 18, AMD 64 #7

Closed paddygoat closed 5 years ago

paddygoat commented 5 years ago

BAT_wav <- read_audio(file.path(wd, "data/c_pip/c_pip_247.wav")) BAT_wav files <- dir(data_dir, recursive = TRUE, full.names = TRUE, pattern = "[.]wav$")

Keep the extracted feature and merge in a single data frame for further analysis

You can use object[["element"]] instead of object$element.

Event_data_01 <- do.call("rbind", c(lapply(TDs, function(x) x$data$event_data), list(stringsAsFactors = FALSE))) nrow(Event_data_01)

Compute the number of extracted c_pip calls

sum(startsWith(Event_data_01$filename, "c_pip"))



> files <- dir(data_dir, recursive = TRUE, full.names = TRUE, pattern = "[.]wav$")
>  BAT_wav <- read_audio(file.path(wd, "data/c_pip/c_pip_247.wav"))
>   BAT_wav

Wave Object
    Number of Samples:      954211
    Duration (seconds):     2.48
    Samplingrate (Hertz):   384000
    Channels (Mono/Stereo): Mono
    PCM (integer format):   TRUE
    Bit (8/16/24/32/64):    16 

>   files <- dir(data_dir, recursive = TRUE, full.names = TRUE, pattern = "[.]wav$")
>   # Keep the extracted feature and merge in a single data frame for further analysis
>   # You can use object[["element"]] instead of object$element.
>   Event_data_01 <- do.call("rbind", c(lapply(TDs, function(x) x$data$event_data), list(stringsAsFactors = FALSE)))
>   nrow(Event_data_01)
[1] 1
>   
>   # Compute the number of extracted c_pip calls
>   sum(startsWith(Event_data_01$filename, "c_pip"))
Error in Event_data_01$filename : 
  $ operator is invalid for atomic vectors
> 

Works OK in Windows 10, but not Ubuntu 18. Any ideas?
paddygoat commented 5 years ago

It's a fault that only occurs in Rstudio. Solution is to use command line eg: Rscript Deploy_bats.R