Question: List Comprehension in R Language Assuming that I have load the data by stat_data the data contains dummy variables and non-dummy variables I want to

List Comprehension in R Language

Assuming that I have load the data by stat_data

the data contains dummy variables and non-dummy variables

I want to run the command that is similar to list comprehension such that

new_data$income_square

new_data$income_cubic

and then it will move to next variable and create the name varible_square varible_cubic in new_data

and input the corresponding data automatically until it finishes all variables

The first one is the dependent variable, all others are independent variables.

List Comprehension in R Language Assuming that I have load the data

1. TW Total Wealth Total wealth equals net financial assets, including Individual Retirement Account (IRA) and 401(k) assets, plus housing equity plus the value of business, property, and motor vehicles. 2.IRA Size of their IRA in dollars 3. E401 1 if eligible for 401(k), 0 otherwise 4. NIFA non-401k financial assets in US $). 5. INC Income (in US $). 6. HMORT home mortgage (in US $). 7. HVAL home value (in US $). 8. Hequity home value minus home mortgage. 9. Educ education (in years). 10. Male 1 if male, 0 otherwise. 11. Twoearn 1 if two earners in the household, 0 otherwise. 12. NOHS 1 if did not graduate from highschool, 0 otherwise. 13. HS 1 if graduate from highschool and did not attend college, 0 otherwise. 14. SMCOI 1 if went to college but did not graduate, 0 otherwise. 15. COL 1 if graduated from college, 0 otherwise. 16. AGE The age of the head of household. 17. FSIZE Family size. 18. MARR 1 if married, 0 otherwise 1. TW Total Wealth Total wealth equals net financial assets, including Individual Retirement Account (IRA) and 401(k) assets, plus housing equity plus the value of business, property, and motor vehicles. 2.IRA Size of their IRA in dollars 3. E401 1 if eligible for 401(k), 0 otherwise 4. NIFA non-401k financial assets in US $). 5. INC Income (in US $). 6. HMORT home mortgage (in US $). 7. HVAL home value (in US $). 8. Hequity home value minus home mortgage. 9. Educ education (in years). 10. Male 1 if male, 0 otherwise. 11. Twoearn 1 if two earners in the household, 0 otherwise. 12. NOHS 1 if did not graduate from highschool, 0 otherwise. 13. HS 1 if graduate from highschool and did not attend college, 0 otherwise. 14. SMCOI 1 if went to college but did not graduate, 0 otherwise. 15. COL 1 if graduated from college, 0 otherwise. 16. AGE The age of the head of household. 17. FSIZE Family size. 18. MARR 1 if married, 0 otherwise

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!