Untitled

 avatar
user_1300604
plain_text
9 months ago
2.0 kB
3
Indexable
# Supongamos que tu dataset se llama ep_data_9
# Cargamos el dataset
ep_data_9 <- read.csv("path_to_your_dataset.csv")

# Convierte los números a abreviaciones directamente en la variable country
ep_data_9$country <- ifelse(ep_data_9$country == 11, "AT",
                     ifelse(ep_data_9$country == 12, "DE",
                     ifelse(ep_data_9$country == 13, "SE",
                     ifelse(ep_data_9$country == 14, "NL",
                     ifelse(ep_data_9$country == 15, "ES",
                     ifelse(ep_data_9$country == 16, "IT",
                     ifelse(ep_data_9$country == 17, "FR",
                     ifelse(ep_data_9$country == 19, "GR", 
                     ifelse(ep_data_9$country == 20, "CH",
                     ifelse(ep_data_9$country == 23, "BE",
                     ifelse(ep_data_9$country == 25, "IL", 
                     ifelse(ep_data_9$country == 28, "CZ",
                     ifelse(ep_data_9$country == 29, "PL",
                     ifelse(ep_data_9$country == 30, "IR", 
                     ifelse(ep_data_9$country == 31, "LU", 
                     ifelse(ep_data_9$country == 32, "HU", 
                     ifelse(ep_data_9$country == 33, "PT",
                     ifelse(ep_data_9$country == 34, "SI", 
                     ifelse(ep_data_9$country == 35, "EE", 
                     ifelse(ep_data_9$country == 47, "HR", 
                     ifelse(ep_data_9$country == 48, "LT", 
                     ifelse(ep_data_9$country == 51, "BG",
                     ifelse(ep_data_9$country == 53, "CY", 
                     ifelse(ep_data_9$country == 55, "FI", 
                     ifelse(ep_data_9$country == 57, "LV", 
                     ifelse(ep_data_9$country == 59, "MT", 
                     ifelse(ep_data_9$country == 61, "RO", 
                     ifelse(ep_data_9$country == 63, "SK", ep_data_9$country)))))))))))))))))))))))))))

# Guarda el dataset modificado
write.csv(ep_data_9, "path_to_your_modified_dataset.csv", row.names = FALSE)
Editor is loading...
Leave a Comment