The hafu dataset has separate columns for the nationality of each parent:

 

   Year                   Series               Character Gender        Father    Mother  Eyes  Hair
1  1963           Yuki no Taiyou                   Sanae      F      Japanese  American            
2  1964               Cyborg 009           Joe Shimamura      M      American  Japanese brown brown
3  1967                Lupin III               Lupin III      M       French? Japanese? black black
4  1967             Nekome Kozou            Cat-Eyed Boy      M      Japanese   Fantasy brown      
5  1972                Gatchaman            Jun the Swan      F                         green green
6  1974           Great Mazinger                Jun Hono      F      American  Japanese black black
7  1975        Ichigo Monogatari                  Ichigo      F Scandinavian? Japanese? brown brown
8  1976 Kochira Katsushika-ku... Reiko Katherine Akimoto      F     Japanese?   French?  blue blond
9  1977     Haikara-san ga Tooru         Shinobu Iijyuin      M      Japanese    German  blue blond
10 1979       Mobile Suit Gundam               Amuro Ray      M      Japanese  Canadian  blue brown

 

Convert the data frame from wide format to long format, with a single column for the parents’ nationality and a column indicating to which parent the nationality refers. Call the first column Nationality and the second column Parent and call the overall data frame in long format hafu_long.

(from: Cotton, 2013, Learning R, O’Reilly)