Displaying 20 results from an estimated 10000 matches similar to: "regular exprs"
2010 Nov 09
3
Row-wise recurive function call
Dear Group,
I have a following dataset:
> a
A B C D
1 22 3 31 40
2 26 31 36 32
3 3 7 49 16
4 24 40 27 26
5 20 45 47 0
6 34 43 11 18
7 48 48 24 2
8 3 16 39 48
9 20 49 7 21
10 17 36 47 10
> dput(a)
structure(list(A = c(22L, 26L, 3L, 24L, 20L, 34L, 48L, 3L, 20L,
17L), B = c(3L, 31L, 7L, 40L, 45L, 43L, 48L, 16L, 49L, 36L),
C = c(31L, 36L, 49L, 27L, 47L, 11L, 24L,
2012 Apr 20
3
Matrix multiplication by multple constants
Dear R helpers
Suppose
x <- c(1:3)
y <- matrix(1:12, ncol = 3, nrow = 4)
> y
[,1] [,2] [,3]
[1,] 1 5 9
[2,] 2 6 10
[3,] 3 7 11
[4,] 4 8 12
I wish to multiply 1st column of y by first element of x i.e. 1, 2nd column of y by 2nd element of x i.e. 2 an so on. Thus the resultant matrix should be like
> z
[,1] [,2] [,3]
[1,] 1
2012 Nov 01
3
convert list without same component length to matrix
Hi,
I have this lame question. I want to convert a list (each with varies in
length) to matrix with same row length by eliminating vectors outside the
needed range.
For example:
l<-list(NULL)
l[[1]]=1,2,3.7
l[[2]]=3,4,5,6,3
l[[3]]=4,2,5,7
l[[4]]=2,4,6,3,2
l[[5]]=3,5,7,2
#so say I want to only have 4 rows and 5 column in my matrix (or
data.frame) and eliminating the 5th index value in l[[2]]
2011 Aug 23
4
Correlation discrepancy
Dear R list, I have one very elementary question regrading correlation between two variables.
x = c(44,46,46,47,45,43,45,44)
y = c(44,43,41,41,46,48,44,43)
> cov(x, y)
[1] -2.428571
However, if I try to calculate the covariance using the formula as
covariance = sum((x-mean(x))*(y-mean(y)))/8 # no of of paired obs. = 8
or
covariance = sum(x*y)/8-(mean(x)*mean(y))
gives
2013 May 21
1
making makepredictcall() work
Dear All,
I'm interested in creating a function similar to ns() from package
splines that can be passed in a model formula. The idea is to produce
"safe" predictions from a model using this function. As I have seen, to
do this I need to use makepredictcall(). Consider the following toy example:
myns <- function (x, df = NULL, knots = NULL, intercept = FALSE,
Boundary.knots =
2010 Oct 15
4
split data with missing data condition
Dear all
I have data like this:
x y
[1,] 59.74889 3.1317081
[2,] 38.77629 1.7102589
[3,] NA 2.2312962
[4,] 32.35268 1.3889621
[5,] 74.01394 1.5361227
[6,] 34.82584 1.1665412
[7,] 42.72262 2.7870875
[8,] 70.54999 3.3917257
[9,] 59.37573 2.6763249
[10,] 68.87422 1.9697770
[11,] 19.00898 2.0584415
[12,] 60.27915 2.5365194
[13,] 50.76850
2008 Sep 17
5
Loop on vector name
[My previous message rejected, therefore I am sending same one with some modification]
I have 3 vectors with object name : dat1, dat2, dat3
Now I want to create a loop, like :
for (i in 1:3)
{
cat(sd(dati))
}
How I can do this in R?
Regards,
2010 Dec 15
0
package JM -- version 0.8-0
Dear R-users,
I'd like to announce the release of the new version of package JM (soon
available from CRAN) for the joint modeling of longitudinal and
time-to-event data using shared parameter models. These models are
applicable in mainly two settings. First, when focus is in the survival
outcome and we wish to account for the effect of a time-dependent
covariate measured with error.
2010 Dec 15
0
package JM -- version 0.8-0
Dear R-users,
I'd like to announce the release of the new version of package JM (soon
available from CRAN) for the joint modeling of longitudinal and
time-to-event data using shared parameter models. These models are
applicable in mainly two settings. First, when focus is in the survival
outcome and we wish to account for the effect of a time-dependent
covariate measured with error.
2011 Sep 28
0
package JM -- version 0.9-0
Dear R-users,
I'd like to announce the release of the new version of package JM (soon
available from CRAN) for the joint modeling of longitudinal and
time-to-event data using shared parameter models. These models are
applicable in mainly two settings. First, when focus is in the survival
outcome and we wish to account for the effect of an endogenous (aka
internal) time-dependent
2011 Sep 28
0
package JM -- version 0.9-0
Dear R-users,
I'd like to announce the release of the new version of package JM (soon
available from CRAN) for the joint modeling of longitudinal and
time-to-event data using shared parameter models. These models are
applicable in mainly two settings. First, when focus is in the survival
outcome and we wish to account for the effect of an endogenous (aka
internal) time-dependent
2012 Jul 10
0
package JM -- version 1.0-0
Dear R-users,
I'd like to announce the release of version 1.0-0 of package JM (already
available from CRAN) for the joint modeling of longitudinal and
time-to-event data using shared parameter models. These models are
applicable in mainly two settings. First, when focus is in the survival
outcome and we wish to account for the effect of an endogenous (aka
internal) time-dependent
2012 Jul 10
0
package JM -- version 1.0-0
Dear R-users,
I'd like to announce the release of version 1.0-0 of package JM (already
available from CRAN) for the joint modeling of longitudinal and
time-to-event data using shared parameter models. These models are
applicable in mainly two settings. First, when focus is in the survival
outcome and we wish to account for the effect of an endogenous (aka
internal) time-dependent
2012 Sep 18
0
New Package 'JMbayes' for the Joint Modeling of Longitudinal and Survival Data under a Bayesian approach
Dear R-users,
I would like to announce the release of the new package JMbayes
available from CRAN (http://CRAN.R-project.org/package=JMbayes). This
package fits shared parameter models for the joint modeling of normal
longitudinal responses and event times under a Bayesian approach using
JAGS, WinBUGS or OpenBUGS.
The package has a single model-fitting function called
jointModelBayes(),
2012 Sep 18
0
New Package 'JMbayes' for the Joint Modeling of Longitudinal and Survival Data under a Bayesian approach
Dear R-users,
I would like to announce the release of the new package JMbayes
available from CRAN (http://CRAN.R-project.org/package=JMbayes). This
package fits shared parameter models for the joint modeling of normal
longitudinal responses and event times under a Bayesian approach using
JAGS, WinBUGS or OpenBUGS.
The package has a single model-fitting function called
jointModelBayes(),
2010 Oct 21
1
How to check for missing report pages per client
Hi,
Not sure how to go about checking for missing report pages per client. See
example below; I like to extract client 730040, because page 46103 is missing.
client page
730001 46101
730001 46102
730019 46101
730035 46101
730040 46101
730040 46102
730040 46104
730040 46105
730052 46101
730052 46102
730074 46101
730074 46102
730074 46103
I appreciate any help,
Pauline
2010 Nov 17
2
slicing list with matrices
A list contains several matrices. Over all matrices (list elements) I'd like to access one matrix cell:
m <- matrix(1:9, nrow=3, dimnames=list(LETTERS[1:3], letters[1:3]))
l <- list(m1=m, m2=m*2, m3=m*3)
l[[3]] # works
l[[3]][1:2, ] # works
l[[1:3]][1, 1] # does not work
How can I slice all C-c combinations in the list?
S?ren
--
S?ren Vogel, Dipl.-Psych. (Univ.), PhD-Student, Eawag,
2010 Nov 25
1
Applying function to elements of matrices in a list
Hello R-help,
Please cc me on all responses, as I only receive summary emails from
this list.
I'm wondering if anybody has any tips on how to accomplish this
efficiently. I have a list of matrices, and I'm trying to get the mean
of the [i,j]'th element of each matrix in a list.
So if I have a list of matrices, say
x <-
2011 Feb 16
2
Axis positions
Hi everyone.
I would like to modify the axis on my plot.
First, I would like to make a plot without the box. so I use :
plot(x,y, axes = FALSE, type = 'l')
Then, I call :
axis(1, tck = -0.02)
axis(2, tck = -0.02)
to have X and Y axis appear. However, I would like them to join at the
origin instead of having a space between the 2 axis. I can't find the
parameter to modify to get
2011 Jun 14
1
Expand DF with all levels of a variable
Dear list,
I would like to expand a DF with all the missing levels of a variable.
a <- c(2,2,3,4,5,6,7,8,9)
a.cut <- cut(a, breaks=c(0,2,6,9,12), right=FALSE )
(x <- data.frame(a, a.cut))
# In 'x' the level "[0,2)" is "missing".
AddMissingLevel <- function(xdf) {
xfac <- factor( c("[0,2)", "[2,6)", "[6,9)",