Displaying 2 results from an estimated 2 matches for "pa9".
Did you mean:
pa
2009 Apr 19
2
Including a vector element in an if statement
Hi all,
I've searched high and low on this and found nothing of help. I'm using
v2.6.2 and trying to write a function that will count how many people from a
dataset fall under a poverty line of 50% of the mean income.
a9 is my 100-element vector of incomes. I want pa9 to be my vector that
counts how many of these are classed as in poverty.
My problem is that my command if(a9[i] < mean(a9)/2 ) returns an "argument
is of length zero" error. But a9[i] is not really of length zero; if I
remove the if() command and simply set pa9[i] = a9[i] in the loop...
2011 Jan 20
4
How to reshape wide format data.frame to long format?
Dear list,
I need to convert this data.frame
> names(codesM)
[1] "key" "AMR.pa1.M" "AMR.pa2.M" "AMR.pa3.M" "AMR.pa4.M"
[6] "AMR.pa5.M" "AMR.pa6.M" "AMR.pa7.M" "AMR.pa8.M" "AMR.pa9.M"
[11] "AMR.pa10.M" "AMR.ta1.M" "AMR.ta2.M" "AMR.ta3.M" "AMR.ta4.M"
[16] "AMR.ta5.M" "AMR.ta6.M" "AMR.ta7.M" "AMR.ta8.M" "AMR.ta9.M"
[21] "AMR.ta10.M" "AMR.ka1.M" &q...