Re: [R] help - extract data using column names

2012-11-01 Thread alex_123
Thanks a lot!!! -- View this message in context: http://r.789695.n4.nabble.com/help-extract-data-using-column-names-tp4647869p4648125.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] help - extract data using column names

2012-10-30 Thread alex_123
hello , I am new user in R . I have datafile (class = data.frame) which has 825 columns with unique column name i want extract 200 selected column from datafile how can I do this? my datafile look like.. Mi RBN RBFnDB nX 3 2.6225979 0.53132756

Re: [R] help - extract data using column names

2012-10-30 Thread jim holtman
Is this what you want: x - read.table(text = Mi RBN RBFnDB nX + 3 2.6225979 0.53132756 -0.80599902 -1.4471864 -0.5705269 + 10 0.4818746 -1.72143092 -2.19579027 2.0118824 -0.5705269 + 12 2.8519611 1.88298265 0.09614617 0.6282549 -0.5705269 +

Re: [R] help - extract data using column names

2012-10-30 Thread Jessica Streicher
A look at the tutorial might help here, but anyway: Say you have that dataframe down there with the name myData (you should use dput() to give us the data btw), then you can subset that by using myData[rows,columns], where left of the comma you define which rows you want, and right of the

Re: [R] help - extract data using column names

2012-10-30 Thread Bert Gunter
Please read the Introduction to R tutorial that ships with R to get started with R. Quoting Rolf Turner: Learn something about R; don't just hammer and hope. Read the introductory manuals and scan the FAQ. Cheers, Bert On Tue, Oct 30, 2012 at 7:09 AM, alex_123 deepak.j...@gmail.com wrote:

[R] Using NCBI E-Utilities in R to extract data from PubMed

2011-08-05 Thread Jokel Meyer
Dear R-experts! I found a great post on the getting genetics done blog which describes how to make use of NCBI E-utilities in Python to extract data from PubMed: http://gettinggeneticsdone.blogspot.com/2011/05/using-ncbi-e-utilities.html I was wondering whether there would be a way to directly

[R] to extract data

2009-04-20 Thread Roslina Zakaria
Hi R-users, I have a set of data from 1958-2009, how do I extract the data from 1927 and 2007?   beechworth.dt Year Month  Rain 1    1858 3  21.8 2    1858 4  47.0 3    1858 5  70.1 4    1858 6  78.7 5    1858 7 101.6 6    1858 8 129.8 7    1858 9  80.8 8   

Re: [R] to extract data

2009-04-20 Thread Uwe Ligges
Roslina Zakaria wrote: Hi R-users, I have a set of data from 1958-2009, how do I extract the data from 1927 and 2007? beechworth.dt Year Month Rain 11858 3 21.8 21858 4 47.0 31858 5 70.1 41858 6 78.7 51858 7 101.6 61858 8 129.8 7

Re: [R] to extract data

2009-04-20 Thread ronggui
If Year is numeric data, then you can use: beechworth.dt.2 - subset(beechworth.dt, Year=1997 Year =2008) If it is character, then you can use: beechworth.dt.2 - subset(beechworth.dt, Year %in% as.character(1997:2008)) 2009/4/20 Roslina Zakaria zrosl...@yahoo.com: Hi R-users, I have a set of

Re: [R] to extract data

2009-04-20 Thread djhurio
Hi, Try this one: beechworth.dt.2 - beechworth.dt[beechworth.dt$Year=1927 beechworth.dt$Year=2007,] Martins On Apr 20, 9:59 am, Roslina Zakaria zrosl...@yahoo.com wrote: Hi R-users, I have a set of data from 1958-2009, how do I extract the data from 1927 and 2007?   beechworth.dt   

Re: [R] to extract data

2009-04-20 Thread Christian Ritz
Hi, maybe the following line works for you: beechworth.dt.2 - beechworth.dt[as.numeric(beechworth.dt$Year) %in% 1927:2007, ] (using as.numeric() to make sure that Year is numeric, maybe not needed?). Christian __ R-help@r-project.org mailing list

Re: [R] to extract data

2009-04-20 Thread Stefan Grosse
On Sun, 19 Apr 2009 23:59:43 -0700 (PDT) Roslina Zakaria zrosl...@yahoo.com wrote: RZ I have a set of data from 1958-2009, how do I extract the data from RZ 1927 and 2007? RZ beechworth.dt RZ Year Month  Rain how about: beech.cut-subset(beechworth.dt,(Year1926Year2008)) hth Stefan

Re: [R] dynamically extract data from a list

2008-08-12 Thread Dries Knapen
Hi, Thanks for your reply. However, this didn't work exactly as I needed it to since the expression is dynamically built as a character vector i.e. not executed as e - expression(Sepal.Width 4) but as e - expression(Sepal.Width 4) in which case subset() throws an error (must evaluate to

Re: [R] dynamically extract data from a list

2008-08-12 Thread Dries Knapen
On 12 Aug 2008, at 17:00, Gabor Grothendieck wrote: Executing strings is probably not a very R-ish thing to do I know - but as far as I can see there was no other way around in this case... but if that's your aim use eval and parse: s - iris[iris$Sepal.Width 4,] eval(parse(text = s))

Re: [R] dynamically extract data from a list

2008-08-12 Thread Dan Davison
Dries Knapen-2 wrote: Hi, Thanks for your reply. However, this didn't work exactly as I needed it to since the expression is dynamically built as a character vector i.e. not executed as e - expression(Sepal.Width 4) but as e - expression(Sepal.Width 4) in which case

Re: [R] dynamically extract data from a list

2008-08-12 Thread Gabor Grothendieck
The code I posted does work if you use it as I explained, not as you changed it. Executing strings is probably not a very R-ish thing to do but if that's your aim use eval and parse: s - iris[iris$Sepal.Width 4,] eval(parse(text = s)) On Tue, Aug 12, 2008 at 10:35 AM, Dries Knapen [EMAIL

Re: [R] dynamically extract data from a list

2008-08-12 Thread Gabor Grothendieck
eval(parse(text = iris[iris$Sepal.Width 4,])) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 16 5.7 4.4 1.5 0.4 setosa 33 5.2 4.1 1.5 0.1 setosa 34 5.5 4.2 1.4 0.2 setosa On

[R] dynamically extract data from a list

2008-08-11 Thread Dries Knapen
Hi, Based on user input, I wrote a function that creates a list which looks like: str(list) List of 4 $ varieties: chr [1:12] temp.26_time.5dagen_biorep.1 time. 5dagen_temp.26_biorep.2 temp.18_time.5dagen_biorep.1 temp.18_time. 5dagen_biorep.2 ... $ temp : Factor w/ 2 levels 18,26:

Re: [R] dynamically extract data from a list

2008-08-11 Thread Gabor Grothendieck
Try this: e - expression(Sepal.Width 4) subset(iris, eval(e), select = Sepal.Length) Sepal.Length 16 5.7 33 5.2 34 5.5 subset(iris, eval(e)) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 16 5.7 4.4 1.5 0.4 setosa