R: added test case for weighted optimal community (#510).