Re: [R] Gather columns based on multiple columns using tidyr

2015-12-18 Thread fahad.usman
Hi David, I did something similar: years <- scotland_weather%>% select(starts_with("Year"))%>% gather(year.col,year)%>% select(-year.col) months <- scotland_weather[seq(1, 24, 2)]%>% gather(month,rainfall_mm) sco

Re: [R] Gather columns based on multiple columns using tidyr

2015-12-18 Thread fahad.usman
Dear Ista, Many thanks for your reply. Your tidyr solution didn’t work: > dput(head(scotland_weather,6)) structure(list(Jan = c(293.8, 292.2, 275.6, 252.3, 246.2, 245 ), Year.1 = c(1993L, 1928L, 2008L, 2015L, 1974L, 1975L), Feb = c

[R] Gather columns based on multiple columns using tidyr

2015-12-17 Thread fahad.usman
Hi, Sorry for this direct approach but I am stuck with a stupid data that I would like to reformat. The datafile is location at: fileURL <- http://www.metoffice.gov.uk/pub/data/weather/uk/climate/datasets/Rainfall/ranked/Scotland.txt You can read the data by: if(!file.exists("scotland_rainfal