Dear Sarah, thank you very much, it is very helpful. please may I ask one more question about a quick and easy tutorial about the loading multiple files (from a folder) in R, and processing one file at a time ? thanks very much again,
bogdan On Fri, May 29, 2015 at 2:55 PM, Sarah Goslee <sarah.gos...@gmail.com> wrote: > I'm still not really clear on what you need (format, etc), but this > may help you get started: > > > with(df, table(CT, row_names)) > row_names > CT A1:A2:A3 B10:B11:B12 B4:B5:B6 B7:B8:B9 D10:D11:D12 D4:D5:D6 E10:E11:E12 > 2 0 0 0 1 2 1 1 > 4 1 1 0 0 0 0 0 > 5 0 0 1 0 0 0 0 > > with(df, table(CT, col_names)) > col_names > CT B1:B2:B3 D1:D2:D3 F10:F11:F12 G7:G8:G9 H1:H2:H3 H4:H5:H6 > 2 1 0 1 1 1 1 > 4 1 1 0 0 0 0 > 5 1 0 0 0 0 0 > > > > On Fri, May 29, 2015 at 4:58 PM, Bogdan Tanasa <tan...@gmail.com> wrote: > > Hi Sarah, > > > > thank you for your help. I have simplified the example, by reading the > > elements in a data frame, eg : > > > > df <- data.frame (row_names = c("B4:B5:B6", "B7:B8:B9", "D4:D5:D6", > > "D10:D11:D12", "D10:D11:D12", "E10:E11:E12", "A1:A2:A3", "B10:B11:B12"), > > col_names = c > > > ("B1:B2:B3","B1:B2:B3","H4:H5:H6","F10:F11:F12","H1:H2:H3","G7:G8:G9","D1:D2:D3","B1:B2:B3"), > > CT = c(5,2,2,2,2,2,4,4) ) > > > > I have used the the count() in the plyr package : > > > > count_row_names <- count(df$row_names) > > count_col_names <- count(df$col_names) > > > > however, I would need to correlate these UNIQUE ELEMENTS in the columns > > "row_names" or "col_names" with the numbers they associate in the CT > > columns, eg : > > > > ""B1:B2:B3" associate with "5, 2, 4" (in CT column), or "D10:D11:D12" > > associate with "2" (in the CT column). > > > > thank you very much, > > > > bogdan > > > > > > > > > > On Fri, May 29, 2015 at 1:32 PM, Sarah Goslee <sarah.gos...@gmail.com> > > wrote: > >> > >> Hi, > >> > >> Please use dput() to provide your data, as it can get somewhat mangled > >> by copy and pasting, especially if you post in HTML (as you are asked > >> not to do in the posting guide). > >> > >> What is a unique element? is "B4:B5:B6" an element, or are "B4" and > >> "B5" each elements? That is, what is the result you expect to obtain > >> for the sample data you provided? > >> > >> What code have you tried? I would think table() might be involved, and > >> possibly strsplit(), but will refrain from putting more time into this > >> until you provide a reproducible dataset with dput() and some clearer > >> idea of your intent. > >> > >> Sarah > >> > >> On Fri, May 29, 2015 at 4:19 PM, Bogdan Tanasa <tan...@gmail.com> > wrote: > >> > Dear all, > >> > > >> > I would appreciate a suggestion on the following : I am working with a > >> > data.frame (below) : > >> > > >> > EXP CT row_names col_names > >> > 1 test -5 B4:B5:B6 B1:B2:B3 > >> > 2 test -2 B7:B8:B9 B1:B2:B3 > >> > 3 test -2 D4:D5:D6 H4:H5:H6 > >> > 4 test -2 D10:D11:D12 F10:F11:F12 > >> > 5 test -2 D10:D11:D12 H1:H2:H3 > >> > 6 test -2 E10:E11:E12 G7:G8:G9 > >> > 7 test -4 A1:A2:A3 D1:D2:D3 > >> > 8 test -4 B10:B11:B12 B1:B2:B3 > >> > > >> > what would be the easiest way to consider UNIQUE elements in the > >> > ROW_NAMES > >> > or the UNIQUE elements in the COL_NAMES and : > >> > > >> > print how many times these UNIQUE ELEMENTS associate with the numbers > >> > -5, > >> > -2, or -4 (these numbers are on the column names CT) .. > >> > > >> > thanks, > >> > > >> > bogdan > >> > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.