How to correctly use readWave in Rstudio - r

Im getting this error while executing this line in RStudio, I have tuneR lib installed.
birds <- readWave("birds.wav")
Error in readBin(con, int, n = 4, size = 1, endian = "little", signed = FALSE) %*% :
non-conformable arguments
In addition: Warning message:
In readChar(con, 4, useBytes = TRUE) : truncating string with embedded nuls
Tried to look for examples and canĀ“t find any that helps me.

Related

Create a dtm using tokens

I try to run tis command
dtm <- CreateDtm(tokens$text,
doc_names = tokens$ID,
ngram_window = c(1, 2))
However I receive this error:
Error in seq.default(1, length(tokens), 5000) :
wrong sign in 'by' argument
In addition: Warning message:
In CreateDtm(tokens$text, doc_names = tokens$ID, ngram_window = c(1, :
No document names detected. Assigning 1:length(doc_vec) as names.
Any idea what I have to change in order to run it properly?

R: Running stan() function get some errors:

when I am running the stan() function I get two errors about Error in file(con, "r") : cannot open the connection and Error in sink(type = "output") : invalid connection. BTW, my .stan file is correct. Please help.
> rstan:::rstudio_stanc("8schools.stan")
8schools.stan is syntactically correct.
> schools_dat <- list(J = 8,
+ y = c(28, 8, -3, 7, -1, 1, 18, 12),
+ sigma = c(15, 10, 16, 11, 9, 11, 10, 18))
> fit_8schools <- stan(file = 'C:/Users/.../Desktop/8schools.stan', data = schools_dat)
The NEXT version of Stan will not be able to pre-process your Stan program.
Please open an issue at
https://github.com/stan-dev/stanc3/issues
if you can share or at least describe your Stan program. This will help ensure that Stan
continues to work on your Stan programs in the future. Thank you!
This message can be avoided by wrapping your function call inside suppressMessages().
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In file.remove(c(unprocessed, processed)) :
cannot remove file 'C:\Users\lpb\AppData\Local\Temp\RtmpW6qdvg\file1f7436407ba4.stan', reason 'No such file or directory'
2: In system(cmd, intern = !verbose) :
running command 'D:/ProgramFiles/R-4.0.2/bin/x64/R CMD SHLIB file1f741c6e1040.cpp 2> file1f741c6e1040.cpp.err.txt' had status 1
3: In file(con, "r") :
cannot open file 'file1f741c6e1040.cpp.err.txt': No such file or directory
Error in sink(type = "output") : invalid connection
> setInternet2(TRUE)
Error: 'setInternet2' is defunct.
See help("Defunct")

How can I debug of adjustOHLC()

I am learning quantmod package. I wrote following codes, but R shows me error. Please help me!
getSymbols("AMZN", from = "2010-01-01", to = "2019-12-20", src = "yahoo")
AMZN_adj = adjustOHLC(AMZN)
The error is
Error in vapply(parse(text = fr[, 2]), eval, numeric(1)) :
values must be length 1,
but FUN(X[[1]]) result is length 3
In addition: Warning message:
In read.table(file = file, header = header, sep = sep, quote = quote, :
incomplete final line found by readTableHeader on 'C:\Users\User\AppData\Local\Temp\RtmpmYhsTS\file964478a68e'
I have check the source code of the function adjustOHLC(), I couldn't find vapply(parse()) anywhere.
Can someone help me to explain what happens in my code?

error in t(dat1) and pairwise not found errors in R

Can someone tell me why the Error in t(dat1) : object 'dat1' not found is appearing, and why Error in is.element("pairwise", names(x)) : object 'pwStats' not found is too?
I'm new to R, and I am trying to visualize the Djost graph shown here:
pwStats <-fastDivPart(infile = microsatellitecoyreadyforR,
outfile = "Coyote_resultspwstats",
gp = 2, bs_locus = TRUE,
bs_pairwise = TRUE, boots = 3)
Error in t(dat1) : object 'dat1' not found
#visualize pwStats
diffPlot(x=pwStats,outfile = "Coyote_resultspwstats", interactive=TRUE)
Error in is.element("pairwise", names(x)) : object 'pwStats' not found

Every command gives several warnings in R even though the code compiles

For the past week or so, every time I've typed a command in any R Markdown document (even simple commands like print(2 + 2), I've gotten the following list of warning messages:
Warning in (function (..., list = character(), pos = -1, envir = as.environment(pos), :
object 'print.htmlwidget' not found
Warning in (function (..., list = character(), pos = -1, envir = as.environment(pos), :
object 'print.html' not found
Warning in (function (..., list = character(), pos = -1, envir = as.environment(pos), :
object 'print.shiny.tag' not found
Warning in (function (..., list = character(), pos = -1, envir = as.environment(pos), :
object 'print.shiny.tag.list' not found
Warning in (function (..., list = character(), pos = -1, envir = as.environment(pos), :
object 'print.knit_asis' not found
Warning in (function (..., list = character(), pos = -1, envir = as.environment(pos), :
object 'print.knit_image_paths' not found
The warnings appear both in the console and below the code chunk in which the command appears. The correct output still appears above the warnings (e.g. when I do print(2 + 2), I get 4 followed by those error messages), and I can still compile and knit documents, but it is quite a nuisance. I'm not sure what I could have done to cause this. I've tried closing and restarting R, making a new markdown document, and re-downloading R Studio, but none of these attempted solutions has worked. Does anyone have any ideas as to why this might be happening and how I could go about fixing it?

Resources