Thank you, I was able to use what you wrote for a lot of my functions.
I did run into some issues for some lines though. I have created a simplified version of what I am trying to do...
Sorry but I can't find the logic in your code, can you clarify what the output of the function should be or how it should looks like?. Preferably as a proper REPRoducible EXample (reprex) illustrating your issue.
Sorry for the confusion, I'm not the best at explaining what I am trying to do
Basically I have a bunch of variables...
height_A_1M, height_D_1M, height _AD_1M, height_F_1M, height_U_1M, height _FU_1M,
weight_A_1M, weight_D_1M, weight _AD_1M, weight_F_1M,weight_U_1M, weight _FU_1M,
age_A_1M, age_D_1M, age _AD_1M, age_F_1M, age_U_1M, age _FU_1M
(and so on with a bunch of other variables)
I need to create a row matrix for each variable.
For example: for height I would want...
Row_height = c(height_A_1M, height_D_1M, height _AD_1M, height_F_1M, height_U_1M, height _FU_1M)
But since I will be having a bunch of variables, I was hoping to find a function that can do this automatically for all the variables haha.
This is what I am trying at the moment, but it isn't working ...
R is not exactly meant to be used this way, R is mostly vectorized so manually defining data structures one element at a time doesn't seem like the best way of doing what you are doing (although, I don't really understand what you are doing).
If you can give a higher level explanation of your task at hand we might be able to give you an alternative solution, possibly using data frames and data wrangling tools specifically designed to work with structured data.