Displaying 2 results from an estimated 2 matches for "study1rb".
2006 May 08
1
performing functions on variables of different length
...of values . However, when I ran the length command
this wasn't the 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...
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 <- cbind(x1 = 3, x2 = c(4:1, 2:5))
dimnames(x)[[1]] <- letters[1:8]
apply(x, 2, mean, trim = .2...