How to display p-value with coefficients in stargazer output for linear regression model in R?

To display p-value in stargazer output for linear regression model, we can use the report argument. For example, if we have a model called RegressionModel then to display the p-value with coefficients can be done by using the below command −
stargazer(RegressionModel,type="text",report=("vc*p"))
Consider the below data frame −
 Live Demo
x1<-rpois(20,1)
x2<-rpois(20,1)
x3<-rpois(20,2)
y1<-rpois(20,10)
df1<-data.frame(x1,x2,x3,y1)
df1
   x1 x2 x3 y1
1  3  0  2  8
2  1  0  2 11
3  1  1  4 11
4  0  1  1 12
5  0  0  1 14
6  2  1  2 11
7  1  0  2  5
8  0  0  1 15
9  4  1  2 10
10 3  2  0  9
11 3  0  2 10
12 3  1  1  8
13 1  1  0 12
14 1  3  2  4
15 2  3  3  7
16 0  3  2  9
17 0  0  1  8
18 2  0  3  6
19 3  2  0  7
20 0  0  2 12
Loading stargazer package and creating the linear model then finding the summary of the model with p-values −
library(stargazer)
Model1<-lm(y1~x1+x2+x3,data=df1) stargazer(Model1,type="text",report=("vc*p"))
===============================================
            Dependent variable:
          ---------------------------
                   y1
-----------------------------------------------
x1             -0.714
             p = 0.143
x2             -0.927
            p = 0.115
x3            -0.610
            p = 0.310
Constant     12.407***
             p = 0.00000
-----------------------------------------------
Observations              20
R2                     0.302
Adjusted R2              0.171
Residual Std. Error   2.634 (df = 16)
F Statistic          2.305 (df = 3; 16)
===============================================
Note − *p<0.1; **p<0.05; ***p<0.01
 Live Demo
z1<-rnorm(20)
z2<-rnorm(20)
z3<-rnorm(20)
y2<-rnorm(20,10,3.1)
df2<-data.frame(z1,z2,z3,y2)
df2
       z1          z2          z3           y2
1  -0.3024865   1.8450469  -0.032156929  14.763669
2  -1.0796487  -1.2162927   1.747917078  16.461999
3  -1.6121022   0.2819740   0.296357366  11.177208
4   1.9958012  -0.1158926  -1.175746738   8.759228
5  -0.1659197   0.3013404  -0.109551154   8.147569
6  -0.9079042  -1.4988982  -0.926541292  13.685437
7   1.1439520   0.4296925  -0.173336829  10.378551
8  -0.8658762  -0.4344171  -0.203837967  15.475533
9  -1.7491852  -1.6852153  -0.025670524  12.039891
10  0.6218240  -1.7620684   1.443519038  14.959877
11  1.5139715   0.1595499  -0.126098531  11.290937
12 -1.4201990   0.9647484   0.466086467   9.191888
13 -1.3909176   0.7077692  -0.388831434   9.950162
14 -0.8915488  -0.2029863  -0.086686050  14.363359
15  2.8241978  -0.8867613   0.855514442  12.082459
16  1.2901426  -0.1418288  -0.005518721   9.116805
17 -0.3083862  -1.5115591  -0.167108671   5.288109
18 -0.7375569   0.7266295   1.044075401  10.463955
19  0.6049541  -0.5745765   1.284913625   8.948373
20  1.0883505   1.2288220  -0.183441449   9.809202
Model2<-lm(y2~z1+z2+z3,data=df2)
stargazer(Model2,type="text",report=("vc*p"))
===============================================
             Dependent variable:
          ---------------------------
                    y2
-----------------------------------------------
 z1              -0.453
               p = 0.387
z2               -0.346
               p = 0.612
z3               0.960
              p = 0.306
Constant      11.082***
             p = 0.000
-----------------------------------------------
Observations             20
R2 0.139
Adjusted               R2 -0.023
Residual Std. Error    2.921 (df = 16)
F Statistic            0.860 (df = 3; 16)
===============================================
Note − *p<0.1; **p<0.05; ***p<0.01