[R] shift by one column given rows in a dataframe

Sarah Goslee sarah.goslee at gmail.com
Thu Jul 23 22:17:53 CEST 2015


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



More information about the R-help mailing list