[R] re moving a vector from a list.

jim holtman jholtman at gmail.com
Thu Oct 2 23:20:29 CEST 2008


Is this what you want to do - it was not clear from your example:

> x
[[1]]
[1] 1

[[2]]
[1] 2

[[3]]
[1] 3

[[4]]
[1] 4

> x <- x[-3]
> x
[[1]]
[1] 1

[[2]]
[1] 2

[[3]]
[1] 4

>
 Or maybe this:

> x <- list(c( 1,2 ,3,4),c(4,5,6,7),c(8,9))
> x
[[1]]
[1] 1 2 3 4

[[2]]
[1] 4 5 6 7

[[3]]
[1] 8 9

> x[[2]] <- x[[2]][-2]
> x
[[1]]
[1] 1 2 3 4

[[2]]
[1] 4 6 7

[[3]]
[1] 8 9

>


On Thu, Oct 2, 2008 at 1:06 PM, Rajasekaramya <ramya.victory at gmail.com> wrote:
>
> Hi there
>
> I have 386 list of vectors.In that i want to delete 23 vector in the 53 list
> element.
>
> [[1]]
> "abc" "dfg" "dft" "err"
>
> [[2]]
> "elm" "erg"" trr" "rtt"
>
> similarly i have [[386]]
>
> now i want to delete or avoid trr in the [[2]].
>
> i just tried something like this
> list[-list[[53]][3]]
>
> --
> View this message in context: http://www.nabble.com/removing-a-vector-from-a-list.-tp19783565p19783565.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list