Re: [R] Creating Vectors

From: jim holtman <jholtman_at_gmail.com>
Date: Sat 01 Jul 2006 - 09:01:04 EST

Does this do what you want? It creates a 'list' with the vectors:

> x <- 'type count

+   0     20
+   1     15
+    0     10
+   1     35
+   0     28
+ '

> x <- read.table(textConnection(x), header=TRUE)
> x


  type count
1 0 20
2 1 15
3 0 10
4 1 35
5 0 28
> type <- split(x$count, x$type)
> type

$`0`
[1] 20 10 28

$`1`
[1] 15 35

> type[['0']]

[1] 20 10 28
> type[['1']]

[1] 15 35
>

On 6/30/06, Raphael Fraser <raphael.fraser@gmail.com> wrote:
>
> type count
> 0 20
> 1 15
> 0 10
> 1 35
> 0 28
>
> I would like to create two vectors from the data above. For example,
> type1=c(15, 35) and type0 = c(20, 10, 28). Can any one help
>
> Raphael
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Jul 01 09:05:14 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 01 Jul 2006 - 10:14:14 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.