I have a dataframe (relatives.ALL.with.status.age) that I want to print as a csv file. When I open the Related_IBD_Pairs_with_status_and_age.csv on Excel, I get this funny number (highlighted in yellow in excel snapshot of Result below). How do I avoid getting this?
I tried the following code:
write.csv(relatives.ALL.with.status.age, "Related_IBD_Pairs_with_status_and_age.csv", quote = FALSE, row.names = FALSE)
data:
relatives.ALL.with.status.age <- structure(list(FID1 = c("0", "0", "0", "0", "0", "0"), IID1 = c("5311",
"10769", "10836", "26192", "26639", "33141"), FID2 = c("0", "0",
"0", "0", "0", "0"), IID2 = c("NACC267941", "NACC106983", "NACC926235",
"NACC902225", "NACC751952", "NACC185636"), RT = c("OT", "OT",
"OT", "OT", "OT", "OT"), EZ = c(0L, 0L, 0L, 0L, 0L, 0L), Z0 = c(0,
6e-04, 3e-04, 3e-04, 0.1957, 5e-04), Z1 = c(0.0022, 0.0082, 0.008,
0.0033, 0.5578, 0.0084), Z2 = c(0.9977, 0.9912, 0.9917, 0.9964,
0.2465, 0.9912), PI_HAT = c(0.9988, 0.9953, 0.9957, 0.9981, 0.5254,
0.9954), PHE = c(-1L, -1L, -1L, -1L, -1L, -1L), DST = c(0.999539,
0.99816, 0.998289, 0.999241, 0.825602, 0.99817), PPC = c(1L,
1L, 1L, 1L, 1L, 1L), RATIO = c(NA, 1599.6667, 2394, 4762, 12.0258,
1602.6667), Relationship = c("parent-offspring", "parent-offspring",
"parent-offspring", "parent-offspring", "parent-offspring", "parent-offspring"
), key1 = c("0:5311", "0:10769", "0:10836", "0:26192", "0:26639",
"0:33141"), key2 = c("0:NACC267941", "0:NACC106983", "0:NACC926235",
"0:NACC902225", "0:NACC751952", "0:NACC185636"), key.1_STATUS = c("unknown",
"unknown", "unknown", "unknown", "unknown", "unknown"), key.1_AGE_AT_ONSET = c(-9L,
-9L, -9L, -9L, -9L, -9L), key.1_AGE_LAST_VISIT = c(-9L, -9L,
-9L, -9L, -9L, -9L), key.1_AGE_AT_DEATH = c(-9L, -9L, -9L, -9L,
-9L, -9L), key.2_STATUS = c("unknown", "CA", "CO", "unknown",
"unknown", "unknown"), key.2_AGE_AT_ONSET = c(-9L, 81L, -9L,
-9L, -9L, -9L), key.2_AGE_LAST_VISIT = c(-9L, -9L, 81L, -9L,
-9L, -9L), key.2_AGE_AT_DEATH = c(-9L, 85L, -9L, -9L, -9L, -9L
)), row.names = c("6738", "6556", "6557", "6693", "6697", "6721"
), class = "data.frame")
I am writing this file on a Linux server from a Windows machine. Perhaps that's the reason why I am getting these erratic values. less -S Related_IBD_Pairs_with_status_and_age.csv
on Linux terminal reads OK though.