Skip to content

rbind help

2 messages · Mike Smith, James W. MacDonald

#
Hi

I have a dataset of orientation and elevation in a dataframe which I am
plotting in circular. Orientation is on the range 0-360, however I need to
reduce this to 0-180 as the values over 180 are not necessarily correct. I
can do

striae$orientation[striae$orientation>180]-180)

to extract these values, but I then want to combine them back in to the
original dataframe (with the elevation values). I assume rbind is the thing
to use and have tried something like:

test <- rbind((striae$orientation[striae$orientation>180]-180),
(striae$orientation[striae$orientation<=180]))

Not being a regular R user I suspect the syntax is easy when you know it!!
Any help much appreciated.

Best wishes

mike
#
Hi Mike,
MikSmith wrote:
I would do the conversion in place:

striae$orientation <- ifelse(striae$orientation > 108, 
striae$orientation - 180, striae$orientation)

Best,

Jim