Re: [R] how to Subset based on partial matching of columns?

2015-04-09 Thread samarvir singh
Thank you. Sarah Goslee. I am rather new in learning R. So people like you are great support. Really appreciate you, taking the time to correct my mistakes. Thanks On Thu 9 Apr, 2015 6:54 pm Sarah Goslee sarah.gos...@gmail.com wrote: Hi, Please don't put quotes around your code. It makes it

Re: [R] how to Subset based on partial matching of columns?

2015-04-09 Thread Sarah Goslee
Hi, Please don't put quotes around your code. It makes it hard to copy and paste. Alternatively, don't post in HTML, because it screws up your code. On Wed, Apr 8, 2015 at 8:57 PM, samarvir singh samarvir1...@gmail.com wrote: So I have a list that contains certain characters as shown below

Re: [R] how to Subset based on partial matching of columns?

2015-04-09 Thread David L Carlson
From Sarah's data frame you can get what you want directly with the table() function which will create a table object, mydf.tbl. If you want a data frame you need to convert the table using as.data.frame.matrix() to make mydf.df. Finally combine the two data frames if your x column consists of

[R] how to Subset based on partial matching of columns?

2015-04-09 Thread samarvir singh
So I have a list that contains certain characters as shown below `list - c(MY,GM+ ,TY,RS,LG)` And I have a variable named CODE in the data frame as follows `code - c(MY GM+, ,LGTY, RS,TY)` 'x - c(1:5) `df - data.frame(x,code)` df x code 1 MY GM+ 2 3 LGTY 4 RS 5 TY