Re: [R] Removing rows in a data frame containing string in rownames

2014-11-16 Thread Jeff Newmiller
Not clear what you did. Is this an example of FAQ 7.16? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Liv

Re: [R] Removing rows in a data frame containing string in rownames

2014-11-16 Thread Steven Yen
Thank you Bill and Dennis. grepl worked great. However, for reason I am not figuring out, the code worked as I included the procedure (subroutine) with a source command, viz., source("z:\\R\\mylib\\me.R") Compiling the routine into a library/package, as I always do, then the command got ig

Re: [R] Removing rows in a data frame containing string in rownames

2014-11-16 Thread William Dunlap
Try grepl() to do pattern matching in strings. ("%in%" checks for equality.) E.g., using your original 'out' do out[ !grepl("sex|rating", rownames(out), ] to get all but the rows whose names contain the character sequences "sex" or "rating". Bill Dunlap TIBCO Software wdunlap tibco.com On Su

[R] Removing rows in a data frame containing string in rownames

2014-11-16 Thread Steven Yen
I like to remove from a data frame rows with labels containing certain string, e.g., "sex" and "rating". Below is a list of the data frame and my failed attempt to the rows. Any clues? Thanks. > out est se t p disc p.(Intercept) 26.430 13.605 1.943 0.053 p.sex