You can add knitr as additional engine into TeXworks similar as already shown on the linked demo page for Texmaker (note: I do not know knitr at all and also I’m not a regular user of TeXworks, so some mistakes are possible):
Edit: Yihui added instructions for TeXworks to the already mentioned page Editors for knitr.
Open the “Preferences” window (can be found in the “Edit” menu) and go to the “Typesetting” tab.
(For next steps see image below.)
Then (step 1 one the image) add a new Processing Tool. In the new window give it a name (step 2) and add the executable file (step 3). Last add the needed arguments (step 4); you can add more than one by repeated pressing the plus sign. I also marked the TeXworks variable
$basename, there exists a
$fullnameas well. Press OK.
Edit: And I made a mistake: The arguments must be splitted into two – first argument
knitr::knit2pdf('$basename.$suffix')(this second changed according to Yihui).
Then you can choose this processing tool in the main window from the menu “Typeset” or from the toolbar popdown: