Hello Ioanna!

Please don't post the same question 4 times in a row. One is just
enough; you can see it posted successfully in the R-help archives:

https://stat.ethz.ch/pipermail/r-help/2019-December/465108.html

On Tue, 17 Dec 2019 19:38:02 +0000
Ioanna Ioannou <ii54...@msn.com> wrote:

> VC <- 0.01*( subset(D, IM.type == 'PGA' & Damage.state == 'DS1' &
> Taxonomy == 'ER+ETR_H1')[10:13] -
> 
>               subset(D, IM.type == 'PGA' & Damage.state == 'DS2' &
> Taxonomy == 'ER+ETR_H1')[10:13])  +
> 
>   0.02*(     subset(D, IM.type == 'PGA' & Damage.state == 'DS2' &
> Taxonomy == 'ER+ETR_H1')[10:13] -
> 
>               subset(D, IM.type == 'PGA' & Damage.state == 'DS3' &
> Taxonomy == 'ER+ETR_H1')[10:13])  +
> 
>   0.43*( subset(D, IM.type == 'PGA' & Damage.state == 'DS3' &
> Taxonomy == 'ER+ETR_H1')[10:13] -
> 
>            subset(D, IM.type == 'PGA' & Damage.state == 'DS4' &
> Taxonomy == 'ER+ETR_H1')[10:13])  +
> 
>   1.0*( subset(D, IM.type == 'PGA' & Damage.state == 'DS4' & Taxonomy
> == 'ER+ETR_H1')[10:13])

If this is supposed to be VC_1 ... VC_4, one way to make a data.frame
of it is: as.data.frame(as.list(setNames(VC, paste0('VC_', 1:4))))
(Though it's not the most elegant way, I'll have to admit.) Use cbind()
to add more columns to the resulting data.frame. Note that this
representation of the data might be not very effective to work with.

> So the question is how can I do that in an automated way for all
> possible combinations

What are "all possible combinations" here?

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to