R: How to resize my matrix by column

I have a disease matrix with the state state0CommercialA, where the columns are the states (i.e. “no disease”, “disease”, “death”) and the rows are the model period (i.e., 1, 2, 3,4, etc.).

I tried to multiply it by the vector of cost vectorMedExp, where each cost corresponds to the disease state. I have tried the following methods:

< /p>

commercialMedExp * states0CommercialA

But it seems that the multiplication occurs in columns instead of across rows. Can someone help me with the correct syntax?

like

 commercialMedExp0A <- t(apply(states0CommercialA, 1, function(x){ x * commercialMedExp}))

As long as the number of columns in states0CommericialA is the same as the length of commercialMedExp, it should work. If not, you must Subset the data. For example, if the disease state is in columns 13 to 18

commercialMedExp0A <- t(apply(states0CommercialA[,c(13:18 )], 1, function(x){ x * commercialMedExp}))

I have a disease matrix with the state state0CommercialA, where the column is the state (ie "no disease", "Illness", "Death"), the line is the model period (ie, 1, 2, 3, 4, etc.).

I tried to multiply it by the vector of cost vectorMedExp, each of which The cost corresponds to the disease state. I have tried the following methods:

commercialMedExp * states0CommercialA

But it seems that the multiplication occurs in columns instead of interrows. Can someone use it correctly Does the grammar help me?

It’s like

commercialMedExp0A <- t(apply(states0CommercialA, 1, function (x){ x * commercialMedExp}))

As long as the number of columns in states0CommericialA is the same as the length of commercialMedExp, it should work. If not, the data must be subsetted. For example, if the disease states In columns 13 to 18

commercialMedExp0A <- t(apply(states0CommercialA[,c(13:18)], 1, function(x){ x * commercialMedExp}))

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5253 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.