[R] How can I get the difference seq directly?
Hi, R-help, let x-rnorm(1000), now I want to get a sequence y,which is satisfied with as follow: y[1]-x[2]-x[1] y[2]-x[3]-x[2] y[999]-x[1000]-x[999] Is there a function in R could achieve this requirement directly? Thank you in advance! 致 礼! 广星 [EMAIL PROTECTED] 2005-11-26 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can I get the difference seq directly?
?diff y - diff(x) HTH, --sundar 广星 wrote: Hi, R-help, let x-rnorm(1000), now I want to get a sequence y,which is satisfied with as follow: y[1]-x[2]-x[1] y[2]-x[3]-x[2] y[999]-x[1000]-x[999] Is there a function in R could achieve this requirement directly? Thank you in advance! 致 礼! 广星 [EMAIL PROTECTED] 2005-11-26 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can I get the difference seq directly?
Thank you very much. I have tried as follow: y-x[2:length[x]]-x[1:(length[x]-1)] apparently, it is not better than the diff. Thank you again. === 2005-11-26 12:19:32 您在来信中写道:=== ?diff y - diff(x) HTH, --sundar 广星 wrote: Hi, R-help, let x-rnorm(1000), now I want to get a sequence y,which is satisfied with as follow: y[1]-x[2]-x[1] y[2]-x[3]-x[2] y[999]-x[1000]-x[999] Is there a function in R could achieve this requirement directly? Thank you in advance! 致 礼! 广星 [EMAIL PROTECTED] 2005-11-26 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html = = = = = = = = = = = = = = = = = = = = 致 礼! 广星 [EMAIL PROTECTED] 2005-11-26 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html