How can I debug of adjustOHLC() - r

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?

Related

How to correctly use readWave in Rstudio

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.

When using the gdcRNAtools package in R, how can I fix the error "line 2 did not have 9 element"?

This error occurred repeatedly while attempting to use the function "gdcRNAmerge" from the package "gdcRNAtools." Several solutions have been proposed, but the problem persists. I would appreciate it if anyone could assist me in resolving this matter. The error message is: Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 2 did not have 9 element)
Below are the codes I used:
BiocManager::install("GDCRNATools")
library(GDCRNATools)
project <- 'TCGA-STAD'
rnadir <- paste(project, 'RNAseq', sep='/')
gdcRNADownload(project.id = 'TCGA-STAD',
data.type = 'RNAseq',
write.manifest = FALSE,
method = 'gdc-client',
directory = rnadir)
metaMatrix.RNA <- gdcParseMetadata(project.id = 'TCGA-STAD',
data.type = 'RNAseq',
write.meta = FALSE)
table(metaMatrix.RNA$sample_type)
table(metaMatrix.RNA$gender)
metaMatrix.RNA <- gdcFilterDuplicate(metaMatrix.RNA)
metaMatrix.RNA <- gdcFilterSampleType(metaMatrix.RNA)
table(metaMatrix.RNA$sample_type)
rnaCounts <- gdcRNAMerge(metadata = metaMatrix.RNA,
path = rnadir,
organized = FALSE,
data.type = 'RNAseq')

Error when using write_as_csv() in rtweet package

When I use the write_as_csv() from the rtweet package, I get the following error:
Twitterstorians_hashtag <- search_tweets(
q="#Twitterstorians",
n = 100,
type = "recent",
include_rts = TRUE,
parse = TRUE,
)
save_as_csv(Twitterstorians_hashtag, "Twitterstorians_hashtag.csv", prepend_ids
= TRUE, na = "", fileEncoding = "UTF-8")
Error in utils::write.table(x, file_name, row.names = FALSE, na = na, :
unimplemented type 'list' in 'EncodeElement'
In addition: Warning message:
In flatten(x) : data frame still contains recursive columns!
If I try to use flatten(), I get the following error:
Error in flatten_int(x) : Not compatible with STRSXP: [type=list].
I'm not sure how to fix these errors? Any suggestions would be much appreciated

Making Demogdata in R

I am new to the R and I am trying to fit mortality data from HMD. However everytime I do a correction, I get an error message about read.demogdata or more specially creating demogdata. I can not create my own demogdata. Here is my code, but I can not move forward:
library(demography)
library(forecast)
aus<-read.demogdata("AUS.Mx_1x1.txt", type="mortality", label="AUS", skip=2)
tra.data<-window(aus, ages=0:16, years=1921:1986)
test.data<-window(aus, ages=0:16, years=1987:2016)
lcmodel<-lca(tra.data)
Error in lca(tra.data) : Not demography data
In where I made a mistake? How can I overcome?
Many thanks in advance..
Also this:
aus2<-read.demogdata("Mx_1x1.txt", "Exposures_1x1.txt",type="mortality",label="AUS")
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 3884 did not have 3 elements
In matrix(tmp1[, i + 2], nrow = m, ncol = n) :

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