I have a set of data with co-authorships of 3k authors. I have columns with Sender and Receiver (or Source and Target) and a column with Journal name and Publication year. If some authors have more than one common article, the results gonna be comma-separated in one row. What I'm looking to do is split these rows into multiple rows. data.frame - my GitHub repository
For instance:
HALL M,DE JONG GF, "['GRAEFE DR 2008 INTERNATIONAL MIGRATION REVIEW', 'HALL M 2010 SOCIAL SCIENCE RESEARCH']"
I need to split the last column like this:
HALL M,DE JONG GF, GRAEFE DR 2008 INTERNATIONAL MIGRATION REVIEW
HALL M,DE JONG GF, HALL M 2010 SOCIAL SCIENCE RESEARCH
I have heard that I need to write a simple cycle in R, but I have no idea how it supposed to look like.
EDIT dput of my data, first 20 rows:
> dput(head(temp,n=20))
structure(list(Source = c("HUMPHREY CR", "HUMPHREY CR", "HUMPHREY CR",
"SELL RR", "SELL RR", "SELL RR", "GARDNER RW", "GARDNER RW",
"GARDNER RW", "GARDNER RW", "GARDNER RW", "GARDNER RW", "GARDNER RW",
"GARDNER RW", "FAWCETT JT", "FAWCETT JT", "FAWCETT JT", "FAWCETT JT",
"FAWCETT JT", "FAWCETT JT"), Target = c("SELL RR", "GILLASPY RT",
"KROUT JA", "GILLASPY RT", "KROUT JA", "DEJONG GF", "FAWCETT JT",
"ARNOLD F", "CARINO BV", "ROOT BD", "DEJONG G", "ABAD RG", "DEJONG GF",
"BOUVIER LF", "ARNOLD F", "PARK IH", "CARINO BV", "ROOT BD",
"DEJONG G", "ABAD RG"), Type = c("Undirected", "Undirected",
"Undirected", "Undirected", "Undirected", "Undirected", "Undirected",
"Undirected", "Undirected", "Undirected", "Undirected", "Undirected",
"Undirected", "Undirected", "Undirected", "Undirected", "Undirected",
"Undirected", "Undirected", "Undirected"), Id = c(2386L, 2385L,
2384L, 3635L, 3634L, 3636L, 401L, 397L, 398L, 399L, 403L, 396L,
400L, 402L, 598L, 602L, 601L, 604L, 605L, 597L), Label = c(NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA), Weight = c(1, 1, 1, 1, 1, 1, 3, 2, 2, 1, 1, 2, 2,
1, 3, 1, 2, 1, 1, 2), ayjid = c("['HUMPHREY CR 1977 RURAL SOCIOLOGY']",
"['HUMPHREY CR 1977 RURAL SOCIOLOGY']", "['HUMPHREY CR 1977 RURAL SOCIOLOGY']",
"['HUMPHREY CR 1977 RURAL SOCIOLOGY']", "['HUMPHREY CR 1977 RURAL SOCIOLOGY']",
"['SELL RR 1978 JOURNAL OF POPULATION']", "['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'DEJONG G 1986 POPULATION AND ENVIRONMENT', 'FAWCETT JT 1994 POPULATION AND ENVIRONMENT']",
"['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'GARDNER RW 1986 POPULATION AND ENVIRONMENT']",
"['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'GARDNER RW 1986 POPULATION AND ENVIRONMENT']",
"['DEJONG G 1986 POPULATION AND ENVIRONMENT']", "['DEJONG G 1986 POPULATION AND ENVIRONMENT']",
"['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'DEJONG G 1986 POPULATION AND ENVIRONMENT']",
"['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'GARDNER RW 1986 POPULATION AND ENVIRONMENT']",
"['BOUVIER LF 1986 POPULATION BULLETIN']", "['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'ARNOLD F 1989 INTERNATIONAL MIGRATION REVIEW', 'FAWCETT JT 1987 INTERNATIONAL MIGRATION REVIEW']",
"['ARNOLD F 1989 INTERNATIONAL MIGRATION REVIEW']", "['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'ARNOLD F 1989 INTERNATIONAL MIGRATION REVIEW']",
"['DEJONG G 1986 POPULATION AND ENVIRONMENT']", "['DEJONG G 1986 POPULATION AND ENVIRONMENT']",
"['DEJONG GF 1983 INTERNATIONAL MIGRATION REVIEW', 'DEJONG G 1986 POPULATION AND ENVIRONMENT']"
)), .Names = c("Source", "Target", "Type", "Id", "Label", "Weight",
"ayjid"), row.names = c(NA, 20L), class = "data.frame")