You can use get-process
to have the right process or ess-get-process
if you use the latest of ESS version on github.
(ess-send-string (get-process "R") "a <- 1:10;a")
Result in
[1] 1 2 3 4 5 6 7 8 9 10
So for your function, something like this should work
(defun create-rtags ()
(interactive)
(ess-send-string (get-process "R") "rtags(ofile = file.path(getwd(), \"TAGS\"))"))