Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x<-data.frame(matrix(runif(1000*5), 1000, 5))
- head(x)
- check.pattern<-function(y){
- #Check increasing, decreasing, and then increasing again
- y[2]>y[1] & y[3]>y[2] & y[4]<y[3] & y[5]>y[4]
- }
- x$results<-apply(X=x, MARGIN=2, FUN=check.pattern)
- head(x)
- > head(x)
- X1 X2 X3 X4 X5
- 1 0.4507316 0.61680485 0.5534436 0.95158639 0.7355047
- 2 0.8733650 0.05122706 0.8663237 0.60773953 0.2751080
- 3 0.5924487 0.68182261 0.8994460 0.06427961 0.4257301
- 4 0.5454436 0.50622038 0.4199539 0.60315238 0.4132902
- 5 0.2360781 0.40259646 0.8383073 0.38447181 0.2686289
- 6 0.5959003 0.80060159 0.1189321 0.12830038 0.1746429
- > head(x)
- X1 X2 X3 X4 X5 results
- 1 0.4507316 0.61680485 0.5534436 0.95158639 0.7355047 FALSE
- 2 0.8733650 0.05122706 0.8663237 0.60773953 0.2751080 FALSE
- 3 0.5924487 0.68182261 0.8994460 0.06427961 0.4257301 TRUE
- 4 0.5454436 0.50622038 0.4199539 0.60315238 0.4132902 FALSE
- 5 0.2360781 0.40259646 0.8383073 0.38447181 0.2686289 FALSE
- 6 0.5959003 0.80060159 0.1189321 0.12830038 0.1746429 FALSE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement