Sorry, the use of rows/columns I found so far was rather contradictive, both refering to what can be gotten via subset() instead of what I'm looking for. Is there a way to get multiple colums/rows? Something like corpus.df${mph,mgl,eng} Thanks in advance for any answers. -- Joel Prokopchuk
Hi Joel, I have no idea what you actually want, since there's no context in your email, but you should probably see: ?"[" for information on how to subset a data frame by rows and/or columns using either numerical indices or names (if appropriate for the object). Sarah On Wed, May 1, 2013 at 4:04 PM, Joel Prokopchuk <joelproko at gmail.com> wrote:> Sorry, the use of rows/columns I found so far was rather > contradictive, both refering to what can be gotten via subset() > instead of what I'm looking for. > Is there a way to get multiple colums/rows? Something like > corpus.df${mph,mgl,eng} > Thanks in advance for any answers. > -- > Joel Prokopchuk >-- Sarah Goslee http://www.functionaldiversity.org
Unless I have misinterpreted, your query indicates that you have made no attempt to learn how R works. Try reading (relevant sections of) "An Introduction to R" or other online R tutorials. ?"[" provides a terse but complete answer to your question, I believe. -- Bert On Wed, May 1, 2013 at 1:04 PM, Joel Prokopchuk <joelproko at gmail.com> wrote:> Sorry, the use of rows/columns I found so far was rather > contradictive, both refering to what can be gotten via subset() > instead of what I'm looking for. > Is there a way to get multiple colums/rows? Something like > corpus.df${mph,mgl,eng} > Thanks in advance for any answers. > -- > Joel Prokopchuk > > ______________________________________________ > 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.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
Hello, Try corpus.df[, c("mph", "mgl", "eng")] Hope this helps, Rui Barradas Em 01-05-2013 21:04, Joel Prokopchuk escreveu:> Sorry, the use of rows/columns I found so far was rather > contradictive, both refering to what can be gotten via subset() > instead of what I'm looking for. > Is there a way to get multiple colums/rows? Something like > corpus.df${mph,mgl,eng} > Thanks in advance for any answers. > -- > Joel Prokopchuk > > ______________________________________________ > 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. >
qinstat at gmail.com
2013-May-01 20:42 UTC
[R] Selecting several columns/rows of a dataframe?
try tb[c('name1','name3'), c('col1','col5')] Hong Qin Sent from my iPad On May 1, 2013, at 4:04 PM, Joel Prokopchuk <joelproko at gmail.com> wrote:> Sorry, the use of rows/columns I found so far was rather > contradictive, both refering to what can be gotten via subset() > instead of what I'm looking for. > Is there a way to get multiple colums/rows? Something like > corpus.df${mph,mgl,eng} > Thanks in advance for any answers. > -- > Joel Prokopchuk > > ______________________________________________ > 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.