Displaying 3 results from an estimated 3 matches for "trend2".
Did you mean:
trend
2011 Feb 24
2
if statements on vectors
I have two vectors: both have possible values of 1,-1, or 0
trend1 <- c(1,1,1,1,1,1,-1,-1,-1,-1,-1,-1)
trend2 <- c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,)
i want to create a third vector that is conditional upon these two vectors:
if (trend2 == 1 && trend1 == 1) {position <- 1}
elseif (trend2 == -1 && trend1== -1) {position <- 1}
else {position <- 0}
based on this two conditions, the p...
2003 Jan 20
0
quadratic trends and changes in slopes (R-help digest, Vol 1 #52 - 16 msgs)
...tml
....
RESPONSE: Since I'm in the process of switching from SAS to R, this was
a good exercise for me. An R program to work the example you cited is
appended. I hope this meets your needs.
Chuck White
# R program for working example at:
# http://www.gseis.ucla.edu/courses/ed230bc1/cnotes4/trend2.html
#
# Copy and paste the example data from the web to a plain text editor
# and save as 'example.txt'. Read the data as follows:
example<-read.table("example.txt", header = FALSE,
col.names=c('y','grp','o1','o2','o3'))
example
# Mak...
2003 Jan 21
1
(v2) quadratic trends and changes in slopes (R-help digest, Vol 1 #52 - 16 msgs)
...results in output tables is so much easier in R than what I've had to
do in SAS that it's incredible. An R program to work the example you
cited is appended. I hope this meets your needs.
Chuck White
# R program for working example at:
# http://www.gseis.ucla.edu/courses/ed230bc1/cnotes4/trend2.html
#
# Copy and paste the example data from the web to a plain text editor
# and save as 'example.txt'. If this program is copied and passted into
# the R Console then the program is expected to run without further
# operator intervention.
#Read the data as follows:
example<-read.tab...