Google is your friend.
On Fri, Oct 11, 2019, 4:21 PM javed khan wrote:
> Hi
>
> I will appreciate if someone provide the link to some tutorials/videos
> where parameters running are performed in R. For instance, if we have to
> perform predictions/classification using random forest or other al
Hi
I will appreciate if someone provide the link to some tutorials/videos
where parameters running are performed in R. For instance, if we have to
perform predictions/classification using random forest or other algorithm,
how different optimization algorithms tune the parameters of random forest
s
Look at what terms() (hence lm()) does with such formulae:
> str(terms(y~1*x))
Classes 'terms', 'formula' language y ~ 1 * x
..- attr(*, "variables")= language list(y, x)
..- attr(*, "factors")= int(0)
..- attr(*, "term.labels")= chr(0)
..- attr(*, "order")= int(0)
..- attr(*, "intercept
Rich:
> x <- 1:10
> y <- runif(10)
> lm(y ~ 1:x)
Call:
lm(formula = y ~ 1:x)
Coefficients:
(Intercept)
0.477
> lm(y ~ x:1)
Call:
lm(formula = y ~ x:1)
Coefficients:
(Intercept)
0.477
> lm(y ~ 1*x)
Call:
lm(formula = y ~ 1 * x)
Coefficients:
(Intercept)
0.477
> lm(y ~ x*1
I can't duplicate your examples
This is what I see
> y ~ 1:x
y ~ 1:x
Please try again in a vanilla R session, and send a reproducible example.
vanilla means start R from the operating system command line with
R --vanilla
this prevents any of your initialization files from being loaded. See
?Star
Hi,
I'm wondering about some logics behind the following simplifications:
y ~ 1:x simplifies to y ~ 1
y ~ x:1 simplifies to y ~ 1
y ~ x*1 simplifies to y ~ x
y ~ 1*x simplifies to y ~ 1
Mainly I would have expected y ~ 1:x to simplify to y ~ x and the cross
operator to be invariant to order.
I
A matrix can be subset by another 2-column matrix, where the first column is
the row index and the second column the column index. So
idx = matrix(c(B, col(B)), ncol = 2)
A[] <- A[idx]
Martin Morgan
On 10/11/19, 6:31 AM, "R-help on behalf of Eric Berger"
wrote:
Here is one way
A <-
Here is one way
A <- sapply(1:ncol(A), function(i) {A[,i][B[,i]]})
On Fri, Oct 11, 2019 at 12:44 PM Jinsong Zhao wrote:
> Hi there,
>
> I have two matrices, A and B. The columns of B is the index of the
> corresponding columns of A. I hope to rearrange of A by B. A minimal
> example is followin
Hi there,
I have two matrices, A and B. The columns of B is the index of the
corresponding columns of A. I hope to rearrange of A by B. A minimal
example is following:
> set.seed(123)
> A <- matrix(sample(1:10), nrow = 5)
> B <- matrix(c(sample(1:5), sample(1:5)), nrow =5, byrow = FALSE)
> A
9 matches
Mail list logo