[R] matrix

arun smartpink111 at yahoo.com
Tue Jul 1 05:08:27 CEST 2014


Hi Izhak,
If the position of the elements to be replaced follow the pattern below:
seq(1,length(t), by=7)
#[1]  1  8 15

t[seq(1,length(t), by=7)] <- c(50,90,100)
A.K.






On Monday, June 30, 2014 4:19 PM, "Adams, Jean" <jvadams at usgs.gov> wrote:
t[1, 1] <- 50
t[3, 2] <- 90
t[5, 3] <- 100

Jean


On Mon, Jun 30, 2014 at 10:27 AM, IZHAK shabsogh <ishaqbaba at yahoo.com>
wrote:

>
>
> kindly guide me on how i can delete and replace an element from a matrix t
> below
>
> for example delete first element in column one and replace it with 50,
> third element in column 2 by 90 and fifth element in column 3 by 100
>
>
> t1<-c(1,2,3,4,5)
> t2<-c(6,7,8,9,10)
> t3<-c(11,12,13,14,15)
> t<-cbind(t1,t2,t3)
>
>
> thanks
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

    [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list