I have imported a table that looks like this:

```
df <- data.frame(study=c("A", "", "", "B", "C", ""), 
                 outcome=c("mortality", "mortality", "surgery", "mortality", "mortality", "surgery"), 
                 time.point=c("30d", "1y", "10d", "1y", "5y", "20d"))

```

The 2nd and 3rd outcome belong to study A, the 6th outcome belongs to study C.
In my table there are various examples like this with irregular number of outcomes and time-points in each study.

How can I assign a good name to each row indicating the study and outcome and time point predicted?

I want it to look like that:

```
df_new <- data.frame(study=c("A", "", "", "B", "C", ""), 
                     outcome=c("mortality", "mortality", "surgery", "mortality", "mortality", "surgery"), 
                     time.point=c("30d", "1y", "10d", "1y", "5y", "20d"), 
                     rowname=c("A_mortality_30d", "A_mortality_1y", "A_surgery_10d", "B_mortality_1y", "C_mortality_5y", "C_surgery_20d"))

```

Thank you so much!