If your data is in a dataframe or matrix and 'grp' is the name of the
columns that you want to select then you can do the
following:> x <- data.frame(a=1:10, b=21:30, c=31:40, d=41:50)
> x
a b c d
1 1 21 31 41
2 2 22 32 42
3 3 23 33 43
4 4 24 34 44
5 5 25 35 45
6 6 26 36 46
7 7 27 37 47
8 8 28 38 48
9 9 29 39 49
10 10 30 40 50> x.sel <- c('d', 'a')
> x[, x.sel]
d a
1 41 1
2 42 2
3 43 3
4 44 4
5 45 5
6 46 6
7 47 7
8 48 8
9 49 9
10 50 10>
If they are the row names, then just reverse the indexing.
On 7/4/06, Sumanta Basak <r_econometrics@yahoo.co.in>
wrote:>
> Hi All,
>
> I have 500 variables time series data for 10 years data. I have sorted 10
> out of them according to them. Now my group is giving character string. But
> i want to fetch those varaible data from theoriginal data. How can i do
> this?
>
> Suppose, total is the data of 500*1500 data. Now i sort 10 variables.
>
> >grp
> >"A41" "A48","A489"
>
> Now how can i fetch only these three variable data from original data?
>
> Thanks,
> Sumanta.
>
>
> ---------------------------------
>
> Catch all the FIFA World Cup 2006 action on Yahoo! India Click here
> [[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
>
--
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]]