Eventstudies package r phys2eventtime null - r

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.

Related

tdplyr - (TDR_E1001) using fastload

I am getting some weird errors, when I try to upload a data.frame to the Teradata database using td_fastload() in R.
The copy_to() method works for smaller sets without any issues, just takes a while... but td_fastload() for bigger sets don't work, here is what I am getting, what does this mean ?
my command is:
td_fastload(con, df = TEST55, table.name = "TEST55", overwrite = TRUE )
and the errors are:
Error: In value[[3L]](cond):
[tdplyr - (TDR_E1001)] Error: In value[[3L]](cond):
[tdplyr - (TDR_E1001)] Error in obtainRows(res, FALSE, params): Argument params class character differs from the required data.frame or list
In addition: Warning messages:
1: In td_fastload(con, df = TEST55, table.name = 'TEST55', overwrite = TRUE):
[tdplyr - (TDR_W1011)] Setting 'overwrite = TRUE' will drop existing table 'TEST55' and recreate it with new schema.
2: In sprintf(gettext(fmt, domain = domain, trim = trim), ...) :
one argument not used by format 'Error in obtainRows(res, FALSE, params): Argument params class character differs from the required data.frame or list
'
3: In sprintf(gettext(fmt, domain = domain, trim = trim), ...) :
one argument not used by format 'Error: In value[[3L]](cond):
[tdplyr - (TDR_E1001)] Error in obtainRows(res, FALSE, params): Argument params class character differs from the required data.frame or list```

How to solve unused argument error as part of a meltAssay?

When using meltAssay to convert a SummarizedExperiment object, the central data infrastructure for microbiome analysis in Bioconductor, into long data.frame, I use the following lines according to the instructions in the book:
tse <- transformSamples(tse, method="relabundance")
molten_tse <- meltAssay(tse,
add_row_data = TRUE,
add_col_data = TRUE,
assay_name = "relabundance")
molten_tse
However, I get the following error:
Error in .melt_assay(x, abund_values, feature_name, sample_name, ...)
: unused argument (assay_name = "relabundance")
Use the following syntax instead: (abund_values instead of assay_names.
There seems to be an error in the book)
molten_tse <- meltAssay(tse,
add_row_data = TRUE,
add_col_data = TRUE,
abund_values = "relabundance")

How to resolve "Error in PSicalc(Stickleback, pop.diet = "sum", exclude = FALSE, replicates = 999, : The input must be an object of class RInSp"?

I am trying to do some excercises in calculating the proportional similarity index with the PSicalc() function from the RInSp pacakge on R but continue receiving an error code.
My code is written as follows:
install.packages('RInSp')
library(RInSp)
data(Stickleback)
PSicalc(Stickleback, pop.diet = "sum", exclude = FALSE, replicates=999, precision = 1e-9)
The error code I receive after running this code is as follows:
Error in PSicalc(Stickleback, pop.diet = "sum", exclude = FALSE, replicates = 999, :
The input must be an object of class RInSp
How can I get this code to run the analysis with the Stickleback dataset that comes with the RInSp R package?

Referencing a column in a table: $ operator is invalid for atomic vector

I am trying to run the following code
Newdata2 = df3%>%
mutate(unemployedempPopRatio = Unemployed * empPopRatio)
With homoskedastic error
fit4 = lm(Satisfaction~Unemployed+empPopRatio+unemployedempPopRatio,Newdata2)%>%
stargazer(header = FALSE, type = 'latex')
With cluster error
cls_err2 = cluster.vcov(fit4, Newdata2$country)
Y = coeftest(fit4,cls_err2)
stargazer(Y, header = FALSE, type = 'latex')
But I am getting an error message that says '$ operator is invalid for atomic vector'. I used the $ operator in the third last line. I checked the type of Newdata2 and it is a list. I am completely new to R and am not sure what went wrong. It would be great if someone could point it out. Thank you.

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

Resources