I am trying to run the following double loop which I have written but it is not running. Unable to get my head around the mistake. Please try to spot the bug and help
> for(i in 1:122){ + for(j in 1:68){ + if(V(FriendGraph)$name[i]==names[j]){ + gender_vector[i]<-sex[j] + break;} + else{gender_vector[i]<-NA} + } } *Error in `[.data.frame`(sex, j) : undefined columns selectedCalled from: `[.data.frame`(sex, j)* Browse[1]> -- Warm Regards, *Shrinivas Dharmadhikari* Metric Consultancy Ltd. 91, Florida Estate, Keshavanagar, Mundhwa Pune-411036. M: +91 98 230 09850 E : dha...@metricuk.com www.metricglobal.com *P* Please consider the environment and do not print this email unless absolutely necessary. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.