I have a dataset in which some columns contain multiple values that are seperated by ";".

Excerpt from dataset:

```
deal_ids<- c("3020269MM","3137144MM"
             ,"3087938MM","3010412MM"
             ,"3054942MM","441272MM")

acquirer_ids<- c("05MW2D-E; 060Y79-E; 07HJ6C-E; 0FT58G-E"
                 ,"0GVB8N-E","05PYR2-E; 0H2MMQ-E","0H3CG6-E",
                 "0JK2T2-E", "05G8Z3-E; 05L112-E")

acquirer_names <- c("Cushman & Wakefield, Inc.; Ontario Teachers' Private Capital; Pacific Alliance Equity Partners Ltd.; TPG Real Estate Partners",
        "Jiangsu Aukura Smart Transmission Engineering Tech Co., Ltd.",
        "City of Shanghai; Hotels & Préférence SARL",
        "Business Empire Investments Ltd.",
        "Profit Sky Corp Ltd",
        "BAIN CAPITAL LLC; Huawei Technologies Co., Ltd.")

acquirer_ownership <-c("Subsidiary; Subsidiary; Subsidiary; Subsidiary",
                       "Public Company",
                       "Government; Subsidiary",
                       "Subsidiary",
                       "Subsidiary",
                       "Private Company; Private Company")

acquirer_country <- c("United States; Canada; Hong Kong; United States",
                      "China (People's Republic)",
                      "China (People's Republic); France",
                      "British Virgin Islands",
                      "Hong Kong",
                      "United States; China (People's Republic)")

acquirer_size<-c("Big",
                 "Big",
                 "Small",
                 "Big",
                 "Small",
                 "Small")

acquirer_secondary_industry <- c("(Real Estate and Rental and Leasing); (-); (-); (-)",
NA, "(-); (-)", "Finance and Insurance", NA, "(-); (Manufacturing; Manufacturing; Manufacturing);" )

acquirer_synopsis <-
c("Cushman & Wakefield Inc, a portfolio company of Pacific Alliance Equity Partners Ltd, TPG Real Estate Partners and Teachers' Private Capital, acquired 20 VIC Management Inc for an undisclosed amount. The acquisition would enhance Cushman & Wakefield Inc's service offerings and expands its market presence in Canada. As part of the transaction, George Buckles and Randy Scharf, co-founders of 20 VIC Management Inc, would join Cushman & Wakefield Inc as executive managing directors. Employees of 20 VIC Management Inc would join Cushman & Wakefield Inc. Following the transaction, 20 VIC Management Inc would operate under the banner of Cushman & Wakefield Inc. 20 VIC Management Inc is located in Toronto, Canada and provides real estate management services."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
, "Jiangsu Aukura Smart Transmission Engineering Tech Co Ltd acquired 284 Partners LLC for an undisclosed amount. 284 Partners LLC is located in Ann Arbor, Michigan, United States and provides intellectual property consultancy."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
, "Hotels & Préférence SARL, a subsidiary of Groupe du Louvre SASU which is ultimately owned by the City of Shanghai, acquired 2Lnet SAS, trading as TemptingPlaces, for an undisclosed amount. The transaction is expected to support Hotels & Préférence SARL's growth and development strategy. Founded by Laurence Onfroy, 2Lnet SAS provides an online platform for hotel bookings. It is based in Paris, France."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
, "Business Empire Investments Ltd, a subsidiary of SEA Holdings Ltd, acquired 33 Old Broad Street Investment Co Ltd from 33 Old Broad Street Holdings Ltd, for GBP258 million (US$332.6 million) in cash. The transaction was funded from Business Empire Investments Ltd's existing cash resources and a term loan facility. 33 Old Broad Street Investment Co Ltd is located in United kingdom and holds and manages properties. The deal was closed as originally expected by July 17, 2017."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
, "Profit Sky Corp Ltd, a subsidiary of Admiral Colour Ltd, ultimately owned by Asia Cassava Resources Holdings Ltd, acquired 338 Apartment (BVI) Ltd from 338 Apartment Holdings (BVI) Ltd, for HKD1.1 billion (US$140.1 million) in cash and assumed liabilities. Under the terms of agreement, HKD570 million (US$72.6 million) was paid in cash and HKD530 million (US$67.5 million) was paid in assumed liabilities. The acquisition was funded through existing cash resources and bank borrowings. The acquisition includes a 25-storey commercial building with hotel license located at 338 Queen's Road Central, Sheung Wan, Hong Kong. 338 Apartment (BVI) Ltd is located in Hong Kong, and owns and operates apartments. The deal was subject to shareholders approval and was expected to be completed on October 08, 2018. On July 03, 2018, Asia Cassava Resources Holdings Ltd announced that despatch of the circular had been postponed from June 30, 2018 to July 31, 2018. On July 31, 2018, Asia Cassava Resources Holdings Ltd announced that despatch of the circular has been postponed from July 30, 2018 to August 31, 2018. On August 21, 2018, it was announced that an extraordinary general meeting would be held on September 06, 2018. On September 06, 2018, shareholders of Asia Cassava Resources Holdings Ltd have approved the acquisition of 338 Apartment (BVI) Ltd in Extraordinary General Meeting. The deal was closed as expected on October 8, 2018."
, "Bain Capital LLC terminated its agreement to acquire 3Com Corp for US$2.1 billion in cash. Under the terms of the agreement, each share of 3Com Corp was to be acquired for US$5.30.  This represented about a 44% premium over 3Com Corp's September 27, 2007 close price of US$3.68. With the acquisition, 3Com Corp aimed to better position itself as a global networking leader. As part of the transaction, Huawei Technologies Co Ltd was going to gain a minority stake in 3Com Corp and become its strategic partner. Based in Marlborough, Massachusetts, 3Com Corp provides secure, converged voice and data networking solutions. On February 20, 2008, 3Com along with affiliates of Bain Capital and Huawei Technologies had withdrawn their joint filing to the Committee on Foreign Investment in the U.S. concerning the parties' proposed merger. The termination is due to the U.S. Government’s Committee on Foreign Investment in the United States saying it intended to take action to prohibit that transaction.")

example_df_2<-
        data.frame(
                deal_ids,
                acquirer_ids,
                acquirer_names,
                acquirer_ownership,
                acquirer_country,
                acquirer_size,
                acquirer_secondary_industry,
                acquirer_synopsis)

```

My goal to "break-up" all these cells across the dataframe. Other cells that dont have multiple values in the row under consideration are supposed to just copy the previous value.

So far I have tried with dplyr and its seperate\_rows.
This does not work:

```
first_try <- example_df %>%
        separate_rows(`deal_ids`,
                      `acquirer_ids`,
                      acquirer_names,
                      `acquirer_ownership`,
                      `acquirer_country`,
                      acquirer_size,
acquirer_secondary_industry,
                acquirer_synopsis)

```

For this reason I applied it in a loop column for column:

```
cols <- colnames(example_df)
for(col in cols) {
        print(col)
        example_df <- separate_rows_(example_df, col,sep = ";")
        example_df <- example_df %>%  mutate(across(where(is.character), str_trim))
        example_df <- unique(example_df)
        gc()
}

```

This however gives me wrong combinations of values - eg: first line of dataframe:

![Wrong result](https://i.stack.imgur.com/Ijlws.png)

How do I solve this?
I want that the delimited data goes with its delimited "partner-data".

EDIT 2 - Special Difficulties:

Difficulty 1) Note that, some of the cells in the dataframe contain delimited Data in paranthesis. These should not be separated but kept as they are.
E.g.: Text1;(Text2;Text2);Text3
should result in 3 different lines and not in 4

Difficulty 2) Some cells, contain more delimited datapoints than others.
E.g.:
Column 1: Text1;Text2
Column 2: OtherText
Column 3: ExampleText1; ExampleText2;ExampleText3

In this case, the expected output should just "copy down" the latest value in the shorter columns.

Kind regards