Hi thank you for your reply: it's a neat solution but unfortunately not applicable to my specific case; in fact as I specified in my first post (I may have been not enough clear, sorry for that!) I can not rely on any search method grep-like because the value "xxx" in the rows of "df_start" can be anything (string or numeric and always different) so that I necessarely need to apply by row index position (i.e. in my reproducible example rows: 2, 3, 5); thank you again for your kind help but still searching for a solution... best -- View this message in context: http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710271.html Sent from the R help mailing list archive at Nabble.com.
Ah, so apparently you require some sort of psychic abilities... For how else would one choose which three values to keep in a row that was: a 2 b 5 based on your specification that "xxx could be anything." Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Thu, Jul 23, 2015 at 12:56 PM, maxbre <mbressan at arpa.veneto.it> wrote:> Hi > > thank you for your reply: it's a neat solution but unfortunately not > applicable to my specific case; > > in fact as I specified in my first post (I may have been not enough clear, > sorry for that!) I can not rely on any search method grep-like because the > value "xxx" in the rows of "df_start" can be anything (string or numeric and > always different) so that I necessarely need to apply by row index position > (i.e. in my reproducible example rows: 2, 3, 5); > > thank you again for your kind help but still searching for a solution... > > best > > > > -- > View this message in context: http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710271.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
On Thu, Jul 23, 2015 at 3:56 PM, maxbre <mbressan at arpa.veneto.it> wrote:> Hi > > thank you for your reply: it's a neat solution but unfortunately not > applicable to my specific case;I'm going to assume you're replying to me, although there's no context whatsoever in your response (this is the R-help email list, not Nabble).> in fact as I specified in my first post (I may have been not enough clear, > sorry for that!) I can not rely on any search method grep-like because the > value "xxx" in the rows of "df_start" can be anything (string or numeric and > always different) so that I necessarely need to apply by row index position > (i.e. in my reproducible example rows: 2, 3, 5);Then how do you know which positions? Do you have another R object that specifies row and column number? Or do you guess? I can easily remove a random element from each row... If you aren't removing based on value, then you didn't provide a reproducible example after all, and you need to supply the index for removal. Always different? Different within a single data frame? Different between data frames? (Then you can simply change "xxx" to "whatever".) Is telepathy required? Or perhaps precognition?> thank you again for your kind help but still searching for a solution... > > best-- Sarah Goslee http://www.functionaldiversity.org
sorry but honestly I do not get your point I need to shift to left by one position (i.e. one column) the entire rows 2,4,5 of "df_start" so that to obtain as final result the structure indicated in "df_end" I know in advance the rows that I need to shift hope it clears a bit, now -- View this message in context: http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710276.html Sent from the R help mailing list archive at Nabble.com.