Displaying 2 results from an estimated 2 matches for "t2freq".
Did you mean:
t1freq
2006 May 02
0
Enquiry regarding Apply
I want to compute a new variable (newvar) based on the values of two other
variables (t1freq, t2freq).The two variables (t1freq,t2freq) are contained
in a dataframe - study1dat <- read.csv("c:\\study1rb.csv",header=T) .
I gather this computation can be done using Apply and I have run the
following example from the help menu
## Compute row and column sums for a matrix:
x &...
2006 May 08
1
performing functions on variables of different length
...case:
length(outcome)
[1] 368
> length(grp)
[1] 184
> length(subject)
[1] 92
> length(time)
[1] 184
Below is the syntax I have been using and the date frame that I generated -
study1dat <- read.csv("c:\\study1rb.csv",header=T)
attach (study1dat)
outcome <- c(t1freq, t2freq,t3freq,t4freq)
grp <- factor( rep(group, 2) )
time <- gl(4, 46)
subject <- gl(46,1,92)
data.frame(subject, grp, time, outcome)
subject grp time outcome
1 1 0 1 4
2 2 0 1 3
3 3 0 1 7
4 4 0 1 0
5 5 0...