search for: nrsex

Displaying 1 result from an estimated 1 matches for "nrsex".

Did you mean: nosex
2010 Apr 11
1
How to assign variable name (of a vector, matrix, array) from element of another vector or by using paste?
Dear All, My problem is the following > varname <- c("age","sex","edu","mrt") > varstates <- c(10,2,4,3) # 10 age groups, 2 sexes, 4 education group and 3 marital status.. Now, I want four variables (vector with length1) named nrage, nrsex, nredu, nrmrt and assing some values > for (i in 1:4) paste("nr",varname[i],sep="") <- varstates[i] #this does not work I want the following >nrage 10 >nrsex 2 .. etc Thanks in advance Best Regards Samir K.C. [[alternative HTML version deleted]]