Hi Uwe,
   I mistook the arguments for the function of arrows. I understand now.
   Thanks again.

2009/11/5 Uwe Ligges <lig...@statistik.tu-dortmund.de>

>
>
> zhijie zhang wrote:
>
>> Hi Uwe,
>>  It works. Why does the following argument generate different results?
>> with(data, arrows(x[-length(x)], y[-length(x)], x[-1], y[-1]))
>> #correct,multiple joins
>>
>
> In the former you select all elements of the vectors except the first or
> last one, respectively.
>
> In the next call you select just one arguemnt of each vector, namely the
> first or last one.
>
> Uwe Ligges
>
>
>   with(data, arrows(x[1], y[1], x[length(x)], y[length(x)]))  #wrong,seems
>> to
>> be only one join
>>  From the ?arrows, the second argument should work. What is the problem?
>>  Thanks a lot.
>> #codes:
>> x<-c(1:6);y<-c(1:6);time<-c(6:1);data<-cbind(x,y,time);data
>> data<-data.frame(data[order(data[,"time"]),])
>> with(data, plot(x,y))
>> with(data, arrows(x[-length(x)], y[-length(x)], x[-1], y[-1]))
>>
>> with(data, plot(x,y))
>> with(data, arrows(x[1], y[1], x[length(x)], y[length(x)]))
>> 2009/11/4 Uwe Ligges <lig...@statistik.tu-dortmund.de>
>>
>>
>>> zhijie zhang wrote:
>>>
>>> Hi,
>>>>  I have a data set with three variables,X Y and Time. X and Y are the
>>>> coordinates of points, i want to join these points according to the Time
>>>> sequence using arrows?
>>>> Demo Example data:
>>>>
>>>> x<-c(1:6)
>>>>> y<-c(1:6)
>>>>> time<-c(6:1)
>>>>> data<-cbind(x,y,time)
>>>>> data
>>>>>
>>>>>    x y time
>>>> [1,] 1 1    6
>>>> [2,] 2 2    5
>>>> [3,] 3 3    4
>>>> [4,] 4 4    3
>>>> [5,] 5 5    2
>>>> [6,] 6 6    1
>>>>  I hope to join the six points with points' time=1 as starting point and
>>>> points' time=6 as endpoint. So the sequence is time=1,2,3,4,5,6 and join
>>>> the
>>>> corresponding points with arrows.
>>>>  Any ideas on it?
>>>>
>>>>
>>> data <- data.frame(data[order(data[,"time"]),])
>>> with(data, plot(y ~ x))
>>> with(data, arrows(x[-length(x)], y[-length(x)], x[-1], y[-1]))
>>>
>>>
>>> Uwe Ligges
>>>
>>>
>>>       [[alternative HTML version deleted]]
>>>
>>>>  ______________________________________________
>>>>
>>>> R-help@r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>>>> <http://www.r-project.org/posting-guide.html>
>>>>
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>>
>>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to