try this:
paste(rep(LETTERS[1:3], each = 3), 1:3, sep = )
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
try this:
x - c(NA, NA, 1, NA, NA, NA, NA, 2, NA, NA)
na.ind - is.na(x)
x[na.ind] - rnorm(sum(na.ind))
x
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven
try the following:
v - c(1, 2, 1, 2, 3, 3, 1)
x - c(3, 2, 1)
fv - factor(v, levels = x)
as.vector(unclass(fv))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35
one way is the following:
data.frame(status = gsub([0-9], , surgery),
time = gsub([a-z], , surgery))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven
you need something like this:
par(mfrow = c(5, 5))
for (i in 1:10) {
nam - paste(Var., i, sep = )
plot(x = time, y = mat[, nam], xlab = Time,
ylab = nam)
}
where `mat' is the matrix containing Var.1, Var.2, Var.3, etc.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
look at: help(cronbach.alpha, package = ltm)
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be
try this:
mat - matrix(rnorm(20*10), 20, 10)
mat[sample(200, 10)] - -Inf
mat
mat[apply(is.finite(mat), 1, all), ]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35
try this:
coef(summary(mod))[, Std. Error]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
try this:
new.list - lapply(my.list, [, i = 1:2)
new.list
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
try this:
x - -3:3
as.matrix(expand.grid(x, x))
# or
t(as.matrix(expand.grid(x, x)))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16
random-slopes (e.g., in lmer()) or an AR1 structure, as you did below.
For the latter case, you probably want to use functions lme() and
gls() from package `nlme'.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic
you could also have a look at function lca() from package `e1071' that
performs a latent class analysis, e.g.,
fit1 - lca(data, 2)
fit1
fit2 - lca(data, 3)
fit2
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic
, x1, 0)
segments(x2, 0 + ds, x2, len)
segments(x3, len + ds, x3, 2*len)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32
you could also have a look at function posdefify() from package
`sfsmisc'.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax
one way is the following (maybe there're better):
pats - do.call(paste, c(as.data.frame(M), sep = \r))
pats - factor(pats, levels = unique(pats))
cbind(unique(M), Freq = as.vector(table(pats)))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School
try the following:
tmp - by(projet, rating, function (x) Thursday, 12.July.2007{
fit - lm(defaults ~ CGDP + CSAVE + SP500, data = x)
summary(fit)$coefficients
})
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
look at setdiff(), e.g.,
setdiff(b, a)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
try this:
test - 1:10
fac - c(3, 6, 9)
outer(test, fac, ) * 1
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16
+ lis[[i]]
out
}
n - 6
p - 5
lis - list(matrix(rnorm(n * p), n, p), matrix(rnorm(n * p), n, p),
matrix(rnorm(n * p), n, p), matrix(rnorm(n * p), n, p),
matrix(rnorm(n * p), n, p))
matFun(lis, sum)
matSums(lis)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D
maybe you want to use ave(), e.g.,
f$sums - ave(f$b, f$e, FUN = sum)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32
the problem is that you start `else' on a new line; check the
following two solutions:
if ( a ) {
cat(TRUE, \n)
} else {
cat(FALSE, \n)
}
# or
{
if ( a )
{
cat(TRUE, \n)
}
else
{
cat(FALSE, \n)
}
}
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
- length(x)
mu - mean(x)
N - if (unbiased) n * (n - 1) else n * n
ox - x[order(x)]
dsum - drop(crossprod(2 * 1:n - n - 1, ox))
dsum / (mu * N)
}
gini(c(100,0,0,0))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical
try this:
which(a == 0.4)[1]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be
probably the function sort.data.frame() posted in R-help some time ago
can be useful; check:
RSiteSearch(sort.data.frame)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address
try the following:
as.logical(rowSums(is.na(Theoph)))
## or
!complete.cases(Theoph)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16
() in the
`bootStepAIC' package, e.g.,
library(bootStepAIC)
boot.stepAIC(result.plr, data = mydata)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel
maybe you're looking for curve(), e.g.,
curve(5*x + 2, -3, 4, ylab = expression(5*x + 2))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0
look at the `arr.ind' argument of ?which(), e.g.,
x - matrix(rnorm(9), 3, 3)
x
which(x == max(x), arr.ind = TRUE)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35
try this:
tapply(re, list(reg, ast), function(x) shapiro.test(x)$p.value)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax
)
all.equal(solve(crossprod(X)), summ.fit.lm$cov.unscaled)
Sigma - summ.fit.lm$sigma^2 * solve(crossprod(X))
all.equal(sqrt(diag(Sigma)), summ.fit.lm$coefficients[, Std. Error])
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
for data.frames try:
rowSums(sapply(dfr, is.na))
whereas for matrices you could use:
rowSums(is.na(mat))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven
sorry but I misread the part about every second column of the
data.frame; in this case you could use:
rowSums(sapply(dfr[seq(1, length(dfr), 2)], is.na))
I hope it helps.
Best,
Dimitris
--
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University
you could use attributes, e.g.,
dat - data.frame(x = 1:3, y = letters[1:3])
attr(dat, name) - my data.frame
attr(dat, author) - John Smith
attr(dat, date) - 2007-05-18
##
dat
attributes(dat)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
))
labs[match(x, sn)]
}))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be
.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be
have a look at: ?as.numeric() and ?data.matrix().
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web
, ]))
all.equal(out1, out2)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
one option is the following:
times - 1:5
rho - 0.5
sigma - 2
###
H - abs(outer(times, times, -))
V - sigma * rho^H
p - nrow(V)
V[cbind(1:p, 1:p)] - V[cbind(1:p, 1:p)] * sigma
V
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School
A is not correlation matrix; try this instead:
A - diag(rep(0.5, 3))
A[1, 2] - 0.5
A[1, 3] - 0.25
A[2, 3] - 0.5
A - A + t(A)
pmvnorm(lower = rep(-Inf, 3), upper = rep(2, 3), corr = A)
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic
Dear R-users,
I'd like to announce the release of the new version of package `ltm'
(i.e., ltm_0.8-0 soon available from CRAN) for Item Response Theory
analyses. This package provides a flexible framework for analyzing
dichotomous and polytomous data under IRT, including the Rasch model,
the
try this:
apply(a, 2, function(x) min(x[x 0]))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
look at ?merge(), e.g., try something like the following:
merge(pretestm, posttest, by = StuNum)
check also the on-line help page for more info, especially for the
'all' argument.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public
try this:
ind1 - do.call(paste, c(as.data.frame(mat1[, 1:2]), sep = \r))
ind2 - do.call(paste, c(as.data.frame(mat2[, 1:2]), sep = \r))
mat1[ind1 %in% ind2, 3] - mat2[ind2 %in% ind1, 3]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School
you need:
a | b
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
one option is use something like the following:
a - 1:10
b777 - rnorm(10)
c777 - letters[1:6]
fit - lm(b777 ~ a)
a777d777 - 5
##
lis - ls()
rm(list = c(lis[grep(777, lis)], lis))
ls()
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
try
citation()
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
maybe you're looking for something like this:
x - rpois(999, 2000)
y - numeric(length(x))
for (i in seq_along(x))
y[i] - sum(exp(rgamma(x[i], scale = 2, shape = 0.5)))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
just try:
cbind(m, m[, censti] m[, survtime])
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
probably you're looking for
tapply(slp_jeo2$slp, slp_jeo2$jeo, mean, na.rm = TRUE)
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16
you could try something like the following:
t2 - lapply(1:11, function(i) c(a, sample(letters[1:5],
sample(10, 1), TRUE), b))
unq.vals - unique(unlist(t2))
ind - rowSums(sapply(t2, %in%, x = unq.vals)) == length(t2)
unq.vals[ind]
I hope it helps.
Best,
Dimitris
Dimitris
one option is the following:
do.call(rbind, lapply(split(tox, tox$id), function (x) {
if (any(ind - x$event == 1))
x[which(ind)[1], ]
else
x[nrow(x), ]
}))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public
=
binomial(link = probit))$coefficients
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
look at R FAQ 7.10
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven
take a look at
?relevel()
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
It would be helpful if you could be more specific of what exactly
you'd like to compute. Have a look also at the posting guide available
at:
http://www.R-project.org/posting-guide.html
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
try the following:
z - matrix(1, ncol = 249, nrow = 240)
zz - matrix(1, ncol = 249, nrow = 240)
for (k in seq_along(x)) {
z[rbind(x[[k]])] - 0
}
zz[xx] - 0
all.equal(z, zz)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public
that the assumption of some common random-effects that the sample
units share might not be valid.
Alternatively, you could model directly the marginal covariance matrix
V using the 'correlation' and 'weights' arguments of gls().
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D
one way is the following:
x - c(10_1, 1_1, 11_1, 2_1, 3_1, 4_1,
5_1, 6_1, 7_1, 8_1)
#
sapply(strsplit(x, _), [, 2)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address
check ?which.max(), e.g.,
x - c(1,4,15,6,7)
which.max(x)
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
if your data set is a matrix try this
new.data - cbind(data, New Column = is.na(data[, Years]) data[,
Products] 20)
whereas if your data set is a data.frame try this
data$New.Column - as.numeric(is.na(data$Years) data$Products
20)
I hope it helps.
Best,
Dimitris
Dimitris
513 %/% 100
513 %% 100
check ?%/% for more info.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
try this:
A1 - matrix(1:20, 5, 4)
B1 - matrix(1:15, 5, 3)
A2 - matrix(1:8, 2, 4)
B2 - matrix(1:6, 2, 3)
#
rbind(cbind(A1, B1), cbind(A2, B2))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic
, 2, function(x) (x - mean(x)) / diff(range(x)) )
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
you could try something like the following (untested):
new.e - eval(substitute(expression(u1+u2+u3), list(u2 = x, u3 = 1)))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address
, new.info)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
try
df.new - cbind(df, ObJeCt[1:10])
names(df.new) - c(names(df), paste(St, 1:10, sep = ))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32
try this:
x - rnorm(200, 35, 5)
y - rnorm(200, 0.87, 0.12)
###
lmObj - lm(y ~ x)
xs - range(x)
ys - predict(lmObj, newdata = data.frame(x = xs))
plot(x, y, pch = 17, bty = l)
lines(xs, ys, col = red, lty = 2, lwd = 2)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D
[unlist(tapply(row.names(score), score$id, tail, n = 2)), ]
look at ?tail() for more info.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16
.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be
try: all(U 0)
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
try this:
set.seed(123)
all.data - data.frame(name = sample(c(Joe, Elen, Jane, Mike),
8, TRUE),
x = rnorm(8), y = runif(8))
##
tab.nams - table(all.data$name)
nams - names(tab.nams[tab.nams = 2])
all.data[all.data$name %in% nams, ]
I hope it helps.
Best,
Dimitris
Dimitris
) if(any(x)) rep(TRUE, length(x)) else x)
out - rbind(x[ind, ], matrix(rep(x[!ind, ], each = nwld), nc = nc))
unique(out[!keep.ind, ])
I hope it works ok.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address
try something along these lines (untested):
DF1[DF1$id %in% DF2$id2, c(val1, val2)]
DF1[!DF1$id %in% DF2$id2, c(val1, val2)]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address
probably you're looking for ?commandArgs().
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http
?table
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be
you can use something like the following:
a - list(A,B,C,D)
b - list(A,B,E,F)
c - list(A,C,E,G)
#
abc - list(a, b, c)
unq.abc - unique(unlist(abc))
out.lis - lapply(abc, %in%, x = unq.abc)
out.lis
lapply(out.lis, as.numeric)
I hope it helps.
Best,
Dimitris
Dimitris
- cor.test(x$Returns, x$MFR.Factor, method = spearman)
c(estimate = cr$estimate, p.value = cr$p.value)
}))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven
try this:
lis. - lapply(lis, function(x) if (length(ind - grep(^IPI, x)))
x[ind[1]] else NULL)
lis.[!sapply(lis., is.null)]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address
maybe cbind() is close to what you're looking for, e.g.,
tb1 - table(x, y)
tb2 - table(x, z)
cbind(tb1, tb2)
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32
x - sample(1:3, 20, TRUE)
x
# do you mean
unique(x)
# or
rle(x)$values
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax
Quoting Ranjan Maitra [EMAIL PROTECTED]:
Yes, of course! Thank you. So, I guess the answer is that R itself
can not be made to do so directly.
Many thanks for confirming this.
Sincerely,
Ranjan
On Wed, 21 Feb 2007 20:23:55 + (GMT) Prof Brian Ripley
[EMAIL PROTECTED] wrote:
.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be
try something like the following (untested):
objs - ls()
sapply(objs, function(obj) inherits(get(obj), data.frame))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35
you probably want to use mvrnorm() from package MASS, e.g.,
library(MASS)
mu - c(-3, 0, 3)
Sigma - rbind(c(5,3,2), c(3,4,1), c(2,1,3))
x - mvrnorm(1000, mu, Sigma, empirical = TRUE)
colMeans(x)
var(x)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical
maybe you could try something along these lines:
x - c(1, 3, 2, 5, 11)
thr - 3
###
ind - t(combn(x, 2))
unique(c(ind[abs(ind[, 1] - ind[, 2]) = thr, ]))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University
careful with Bootstrap if you wish
to obtain CIs for extreme quantiles in small samples.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16
one way is the following:
assignation$value[match(x, assignation$class)]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax
probably you want something like the following:
A[cbind(rep(1, length(x)), x, y)]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16
(); gc()})
system.time(for (i in 1:m) {
W2[i, ] - g2(A[i, ])
})
## or
invisible({gc(); gc()})
system.time(W3 - t(apply(A, 1, g2)))
all.equal(W1, W2)
all.equal(W1, W3)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
you need: unique(A[, 2])
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http
you need to return x in the function within lapply(), e.g., something
like
lapply(TP, function(x) { x[is.na(x)] - 0; x })
I hope it works.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address
check the help page for ?matrix(); you probably want either
matrix(V1, nrow = 5)
or
matrix(V1, nrow = 5, byrow = TRUE)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer
you need the 'SIMPLIFY' argument of mapply(), i.e.,
mapply(%*%, a, b, SIMPLIFY = FALSE)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0
functions.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be
based on Marc's approach, I think you can even use
which((mat2 %in% mat1)[1:nrow(mat2)])
instead of
which(apply(matrix(mat2 %in% mat1, dim(mat2)), 1, all))
I hope it helps.
Best,
Dimitris
Quoting Marc Schwartz [EMAIL PROTECTED]:
On Sun, 2007-01-21 at 00:14 +0200, Adrian Dusa wrote:
Dear
I think the following should work in your case:
mat1 - data.matrix(expand.grid(0:2, 0:2, 0:2))
mat2 - mat1[c(19, 16, 13, 24, 8), ]
ind1 - apply(mat1, 1, paste, collapse = /)
ind2 - apply(mat2, 1, paste, collapse = /)
match(ind2, ind1)
I hope it helps.
Best,
Dimitris
Quoting
1 - 100 of 567 matches
Mail list logo