Error when using write_as_csv() in rtweet package - r

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

Related

Twitter streaming error, 'invalid length argument'?

The code is as follows;
Supplier_List <- data.frame(companies = c("company1","company2","company3"))
Streamed_Tweets <- purrr::map_df(Supplier_List$companies, ~{
search_tweets2(.x, retryonratelimit = TRUE,include_rts=FALSE,lang="en")
#Sys.sleep(5)
}, .id = 'id')
The error that comes up is
Error in vector("list", ntimes) : invalid 'length' argument
Could anyone please help?

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?

Eventstudies package r phys2eventtime null

I am using the eventstudies package in R and I am struggling to replicate the eventsudy function which is used as an example in the package as below:
# Event study without adjustment
es <- eventstudy(firm.returns = StockPriceReturns,
event.list = SplitDates,
event.window = 7,
type = "None",
to.remap = TRUE,
remap = "cumsum",
inference = TRUE,
inference.strategy = "bootstrap")
I use my own data for StockPriceReturns and SplitDates and even though I have tried to make them of the same format, type etc of those above I think this is where it is failing. The message I am getting is:
Error in phys2eventtime(z = returns$firm.returns, events =
event.list[i, : events$name should a character class. In addition:
Warning message: In is.na(events$name) : is.na() applied to
non-(list or vector) of type 'NULL'
Any help would be much appreciated.

Resources