Hi,
You can try the following script:
_ _ 
# mymatrix: column1 = income, column2 = frequency
matrix mymatrix = {35, 5; 120, 5; 150, 0; 320, 6; 400, 5}
matrix result = {}
loop i=1..5
    loop mymatrix[i,2]
        result = result | {mymatrix[i,1]}
    endloop
endloop
print mymatrix result
_ _ 
Best,
Artur



__________________________________________

Artur Bala

development economist

financial inclusion policy advisor & project evaluator

(+216) 22 99 73 44

(+39) 34 86 11 17 20



Le ven. 4 août 2023 à 03:39, <jota3mc@gmail.com> a écrit :
Hi,
Is there a way to reverse a frequency table? Suppose I have a matrix of two columns. The first has values for income per capita variable and the second column has the number of persons that earned each specific income. Is there a way to generate a new matrix with only one column that repeats each income per capita value by the number of persons (frequency)?

Thanks.
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave@gretlml.univpm.it
Website: https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/