[R] Help with finalfit and knitr

Bill Poling Bill@Poling @ending from zeli@@com
Wed Aug 8 15:49:18 CEST 2018


Hi using some of my own data I am trying to reproduce examples from this tutorial:

https://cran.r-project.org/web/packages/finalfit/vignettes/finalfit_basics.html

Here are my sys info:
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server >= 2012 x64 (build 9200)

Here is my data structure:
str(df6)
# 'data.frame': 78407 obs. of  6 variables:
#   $ ProductName    : Factor w/ 2 levels "Editing","OON": 2 2 2 2 2 2 2 2 2 2 ...
# $ RevCodeCats    : Factor w/ 20 levels "BHAccomodations",..: 10 10 12 12 8 8 12 20 8 19 ...
# $ AgeCat         : Factor w/ 10 levels "[>80]","[0-5]",..: 9 9 5 5 7 4 7 7 7 9 ...
# $ PatientGender  : Factor w/ 3 levels "F","M","U": 2 2 2 2 2 1 1 1 1 1 ...
# $ AcceptedSavings: num  0 0 0 0 48.9 ...
# $ BinaryAccSav   : Factor w/ 2 levels "0","1": 1 1 1 1 2 2 2 2 2 2 ...

Here is my call:

explanatory = c("ProductName", "AgeCat", "PatientGender")
dependent = "BinaryAccSav" #------------------------------------------------------- AcceptedSavings 1=Y 0=N
df6 %>%  finalfit(dependent, explanatory, p=TRUE, add_dependent_label=TRUE) -> t1 knitr::kable(t1, row.names=FALSE, align=c("l", "l", "r", "r", "r"))

Here is the error:
#Error: unexpected symbol in " df6 %>%  finalfit(dependent, explanatory, p=TRUE, add_dependent_label=TRUE) -> t1 knitr"

The error is identifying the knitr::kable(t1, row.names=FALSE, align=c("l", "l", "r", "r", "r")) as the problem

I believe I have copied the procedure correctly from the tutorial and replaced the tutorial variables with mine.

Libraries I believe are necessary:
library("knitr", lib.loc="~/R/win-library/3.5")
library("rmarkdown", lib.loc="~/R/win-library/3.5")
library("htmlTable", lib.loc="~/R/win-library/3.5")

And I see --Warning in install.packages :  package 'kable' is not available (for R version 3.5.1) which I believe is my problem?


  1.  can my hunch be validated by someone please?
  2.  Is there a solution for this?
  3.  or do I contact the package authors directly?

Thank you all!

WHP


Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}



More information about the R-help mailing list