Reputation: 13
I have a data set containing information on Crypto, S&P500 ETF, CRIX, FED Reserves, Commodities, etc. I am trying to create a Summary Statistics Table and found that the package "stargazer" is the best research publications. I don't want all of the variables from the dataset to be in the table so I tried the following code:
stargazer(df[c("BNBClose", "BTCClose", "ADAClose", "LINKClose", "DODGEClose", "EOSClose", "ETHClose", "MIOTAClose", "LTCClose", "XMRClose", "XEMClose", "XLMClose", "USDTClose", "TRXClose", "XRPClose", "FEDWALCL", "FEDM0Reserves", "FEDM0Total", "CETFClose", "CRIXClose", "SPYClose", "GLDClose", "OILClose")],type="text",title="Summary Statistics", out="table1.txt")
And the following error occurs:
Error in if (length(c(year, month, day, hour, min, sec)) == 6 && all(c(year, :
missing value where TRUE/FALSE needed
I have no missing values in the entire Data Set. I don't know what else to do. Any help would be much appreciated. If you have another package recommendation to try and produce and export (to latex) a descriptive statistics table containing the mean, sd, min, max, skewness and kurtosis would also be of much help.
The reproducible example data set is the following:
data_stuct <-
structure(
list(
Date = structure(
c(
17441,
17442,
17443,
17444,
17445,
17446,
17447,
17448,
17449,
17450
),
class = "Date"
),
BNBClose = c(
1.96466994285583,
1.82070004940032,
1.60148000717163,
1.67849004268646,
1.57991003990173,
1.58424997329711,
1.21722996234893,
1.4037799835205,
1.39336001873016,
1.43373000621795
),
BNBReturn = c(
0.286941022473697,
-0.0747675854046642,-0.135036469092375,
0.0266057079361807,
-0.058069140833992,
-0.0130882480387323,-0.227734156731425,
0.162348536759326,
-0.0263508788443867,
0.0245026259536907
),
BTCClose = c(
4409.31982421875,
4317.47998046875,
4229.35986328125,
4328.41015625,
4370.81005859375,
4426.89013671875,
4610.47998046875,
4772.02001953125,
4781.990234375,
4826.47998046875
),
BTCReturn = c(
0.00307332788380803,-0.0206375880182435,
-0.0208387453411515,
0.0232938703148199,
0.0107181238986895,
0.0131690154774654,
0.0408179529812949,
0.0341313938033363,
0.00121022180447976,
0.00777365568069113
),
ADAClose = c(
0.0259317997843027,
0.0208158008754253,
0.0219314992427825,
0.0214887000620365,
0.0185391008853912,
0.0209408998489379,
0.0204771999269723,
0.02211369946599,
0.0215313006192445,
0.0225195009261369
),
ADAReturn = c(
0.0538382925523828,
-0.191826507565934,
0.0511596482131408,
-0.0210738824748107,
-0.132019856680562,
0.137233310475833,
-0.0216059683246936,
0.0869727271720155,
-0.026266109908542,
0.0483939151162756
),
LINKClose = c(
0.356766998767852,
0.345535010099411,
0.397361010313034,
0.406538009643554,
0.475764989852905,
0.463656991720199,
0.397136986255645,
0.380589008331298,
0.407469004392623,
0.450462996959686
),
LINKReturn = c(
-0.184843753787707,
-0.059138850859273,
0.157859063823257,
0.0239478473239544,
0.170914967745977,
-0.0181875540911234,
-0.141299439924916,-0.0591264151564786,
0.0711621651773824,
0.0819438214938677
),
DODGEClose = c(
0.00108535995241254,
0.0011083900462836,
0.00102437997702509,
0.001001329976134,
0.00105603004340082,
0.00106609996873885,
0.00105591001920402,
0.000990716973319649,
0.00103567994665354,
0.00104612996801733
)
),
row.names = c(NA,-10L),
class = c("tbl_df",
"tbl", "data.frame")
)
I tried doing the summary for the Data Set that is not declared as a time series by running the code:
stargazer(WorkingVariables, type = "text", title = "Summary Statistics", out = "table1.txt")
And the output in the console has the structure I'm looking for (more or less, the number of observations, the skewness and the kurtosis are missing) but it is empty. It shows as follows:
Summary Statistics
===================================================
Statistic N Mean St. Dev. Min Pctl(25) Pctl(75) Max
===================================================
With nothing underneath, anyone know what is happening? Same Sample Data should work.
Upvotes: 1
Views: 5041
Reputation: 389055
You have a tibble and stargazer
doesn't support it. If you change it to dataframe it works.
library(stargazer)
data_stuct <- data.frame(data_stuct)
stargazer(data_stuct[c("BNBClose", "BTCClose", "ADAClose", "LINKClose",
"DODGEClose")],type="text",title="Summary Statistics", out="table1.txt")
#Summary Statistics
#========================================================================
#Statistic N Mean St. Dev. Min Pctl(25) Pctl(75) Max
#------------------------------------------------------------------------
#BNBClose 10 1.568 0.219 1.217 1.411 1.659 1.965
#BTCClose 10 4,507.324 220.613 4,229.360 4,339.010 4,731.635 4,826.480
#ADAClose 10 0.022 0.002 0.019 0.021 0.022 0.026
#LINKClose 10 0.408 0.043 0.346 0.385 0.440 0.476
#DODGEClose 10 0.001 0.00004 0.001 0.001 0.001 0.001
------------------------------------------------------------------------
Upvotes: 0