Re: [R] help with column substaction with a twist

2014-07-21 Thread Greg Snow
Here is another approach in R (blatantly stealing Jim Holtman's code to generate sample data): > set.seed(1) > n <- 100 > test <- data.frame(p = sample(10, n, TRUE) + , b = sample(10, n, TRUE) + ) > test$e <- sample(5, n, TRUE) + test$b # make sure e > b > > tmp1 <

Re: [R] help with column substaction with a twist

2014-07-20 Thread Ubernerdy
Thanks you guys, you are awesome. -S On Sun, Jul 20, 2014 at 5:36 PM, John McKown wrote: > On Sun, Jul 20, 2014 at 6:33 AM, Ubernerdy wrote: > > Hello guys! > > > > I have been messing around with R for a while now, but this situation has > > me a bit stumped. I was unable to solve it by readi

Re: [R] help with column substaction with a twist

2014-07-20 Thread John McKown
On Sun, Jul 20, 2014 at 6:33 AM, Ubernerdy wrote: > Hello guys! > > I have been messing around with R for a while now, but this situation has > me a bit stumped. I was unable to solve it by reading documentation. > > So I have this table (currently in Excel - could export it as csv) with > values

Re: [R] help with column substaction with a twist

2014-07-20 Thread jim holtman
try this: > # generate test data > set.seed(1) > n <- 100 > test <- data.frame(p = sample(10, n, TRUE) + , b = sample(10, n, TRUE) + ) > test$e <- sample(5, n, TRUE) + test$b # make sure e > b > # add distance > test$dist <- ifelse(test$p < test$b +

[R] help with column substaction with a twist

2014-07-20 Thread Ubernerdy
Hello guys! I have been messing around with R for a while now, but this situation has me a bit stumped. I was unable to solve it by reading documentation. So I have this table (currently in Excel - could export it as csv) with values in 3 columns. Let's call them value P (for position), value B (