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
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 3
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: Kapucijn
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 Universi
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
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: ht
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: Kapucijnenv
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
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://www.student.
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
F
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
could include
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 Publ
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 Heal
plot(density(x))
len <- 0.005
ds <- 0.001
segments(x1, -1, 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: K
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
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/33689
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
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
, n, p),
matrix(rnorm(n * p), n, p))
matFun(lis, sum)
matSums(lis)
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/3
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:
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&qu
ntain NAs")
if (na.rm)
x <- x[!na.ind]
n <- 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))
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
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
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 Leuve
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: +
on of it, i.e., boot.stepAIC() 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 3
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
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: Kapucijne
lm)
X <- model.matrix(fit.lm)
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. St
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
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
yfun()
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/
"mid", rep("low", length(sn) - 2))
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
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
attribute
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
immedMeanByGroup2(x[i, ],
g[i, ]))
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:
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
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 o
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
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 Tw
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
Biostatisti
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
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
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 R
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
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
Fa
ind]
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://www.stu
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/
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 Pub
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
fit(x = cbind(1, women$M, women$S), y = women$J, family =
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, Belg
r]",
ylab="Green at 9 AM : NOx [(µg/m3)*hour]",
cex.main = 1.8, cex.lab = 1.5, cex.axis = 1.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, B
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 H
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
Scho
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
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: h
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.
st,
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/~m0390867/
; data$Products >
20)
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
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
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 Hea
ly(mat, 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
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
Addr
=2,
cild.ages1 = 3, cild.ages2 = 5, cild.ages3 = NA)
rbind(dat, 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: +
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: Kapucijnenvo
ight be useful to sort first
# score <- score[order(score$id), ]
score
score[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
Cathol
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,
els(f.out))[as.integer(f.out)]
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:
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/
h
name %in% nams, ]
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/
h
[-(1:nr)], nc = nwld, by =
TRUE),
1, function(x) 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 Publ
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 Healt
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:
?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
dCDF(c(1,2,3,4,5), numint=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: h
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 Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kap
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,
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
uot;MFR.Factor")],
dat$Period),
function (x) {
cr <- 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. Studen
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
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
-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/biostat/
http://w
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: Kapu
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
Biost
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
Catholi
c", "bca"), index = i))
However, you should be a little bit 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 Univ
theta + 2*pi*(theta < 0)
}
tB <- t(B)
invisible({gc(); 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 Rizop
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
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
nts(x3, y3, pch = 3, cex = 3, col = 3)
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.kul
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
Addr
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 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,
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
in many R 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.k
you can use the `...' argument of integrate, e.g.,
integrate(dnorm, 0, 1)
integrate(dnorm, 0, 1, mean = 0.1)
integrate(dnorm, 0, 1, mean = 0.1, sd = 1.2)
look at ?integrate for more info.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
Scho
1 - 100 of 591 matches
Mail list logo