[R] automate "press enter"

Doran, Harold HDoran at air.org
Thu Mar 12 16:25:28 CET 2015


I’m dealing with an issue that is seemingly simple, and I’m sure there is an obvious solution. I’m writing a wrapper function that calls functions from another package (twitteR).

However, the function I happen to be using in that package prompts the user the user to enter a “1” or a “2” in the workspace before the user can proceed. The actual process looks like this:

> setup_twitter_oauth(APIkey,APIsecret, Accesstoken, Accesssecret)

Use a local file to cache OAuth access credentials between R sessions?
1: Yes
2: No

I know I want the value  “2” to be entered, but I cannot figure out how to automate it without a human actually entering “2” and hitting enter when prompted.

Is it possible to automate this so the user doesn’t have to manually hit enter?

Harold



	[[alternative HTML version deleted]]



More information about the R-help mailing list