Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

knit2wp error. Doesn't recognize username or password

Tags:

r

I'm using the knitr package to post an .Rmd file to wordpress. First time I'm working this type of project and am having the following error/issue. Can anyone help identify the issue. Have done a number of Google searches but haven't seem similar issues. Also tried to use the newPost function for this task but that was unfruitful.

if (!require('RWordPress'))
  install.packages('RWordPress', repos = 'http://www.omegahat.org/R', type = 'source')
library(RWordPress)
options(WordPressLogin = c(username = "*****"),
        WordPressURL = "https://mathewanalytics.com/xmlrpc.php")

library(knitr)
knit2wp("Logistic_Regression_Document.Rmd", 
        title = "Evaluation Logistic Regression in R", 
        shortcode=TRUE, publish=FALSE )


List of 4
 $ results: chr "hide"
 $ message: logi FALSE
 $ warning: logi FALSE
 $ eval   : logi FALSE

  |.................................................................| 100%
  ordinary text without R code


output file: Logistic_Regression_Document.md

Error in getOption("WordpressLogin", stop("need a login and password")) : 
  need a login and password
In addition: Warning messages:
1: In Ops.factor(1, obs) : '-' not meaningful for factors
2: In Ops.factor(1, obs) : '-' not meaningful for factors
3: In Ops.factor(1, y) : '-' not meaningful for factors
like image 464
some_guy Avatar asked Aug 30 '15 15:08

some_guy


1 Answers

I had this problem too, and it turned out to be a problem with the variable names.

You are setting: (note the capital P)

WordPressLogin = c(username = "*****")

But the function is throwing this error:

Error in getOption("WordpressLogin", stop("need a login and password"))

So if you set the right variables:

options(WordpressLogin = c(username = "*****"),
         WordpressURL = "https://mathewanalytics.com/xmlrpc.php")

Then you should be ok.

like image 64
Mark Avatar answered Oct 22 '22 05:10

Mark