Update trend.R

further fix for multi-variate trend analysis