First:
source("D:\something.R")
cannot work. You have a single backslash character. Use:source(@"D:\something.R")
Probably the same thing with the following, as an aside:"sentence = gsub('\\d+', '', sentence)" +
besides the whole string you build is not a valid function declaration: you have no semi-colon or newline separator between statements.source(@"D:\something.R")
var sentiment = engine.GetSymbol("score.sentiment").AsFunction();
You'll find sample code on how to invoke functions for instance in https://github.com/jmp75/rdotnet/blob/master/RDotNet.Tests/RFunctionsTest.cs