add R and C++ for rthcolsums