I am making frequency tables (from a long list of genetic sequences) of the number of times genes appear in my sequencing samples. I've been using the ftable() function just fine, but I am narrowing my search and want to focus on a few specific genes out of the many thousands.
My worflow currently is as follows:
- I create frequency tables for all genes in a sample.
- Export this table to a csv.
- Use control+f in Excel to pull out the specific gene frequencies I'm interested in.
This seems very inefficient given the number of samples I am planning to analyze.
Is there a way to use R to extract certain entries in the frequency table?
So far I have tried the [c(, , ,)] and a[, , ,] methods to no avail. I've been getting an "unexpected symbol" error.
I'm hoping the issue isn't the hyphen in the gene name because I can't remove that.
I attached a screenshot of my R window for reference.
Here's a screenshot of my R window Here are the frequency table attributes
structure(list(Sequence.number = c(1L, 2L, 4L, 5L, 6L, 7L, 10L,
11L, 13L, 14L), Variable = structure(c(25L, 2L, 22L, 19L, 19L,
19L, 7L, 1L, 25L, 19L), .Label = c("V1-13", "V1-18", "V1-2",
"V1-21", "V1-36", "V1-39", "V1-42", "V10D-9", "V11-25", "V12D-36",
"V12D-56", "V15D-54", "V1D-15", "V1D-73", "V3-20", "V3D-30",
"V4D-24", "V4D-43", "V4D-60", "V6-31", "V6-35", "V6-4", "V6D-40",
"V6D-76", "V8-30", "V8-46", "V8-5", "V9-15", "V9-23", "V9D-2"
), class = "factor"), Diversity = structure(c(13L, 17L, 2L, 5L,
3L, 5L, 2L, 14L, 13L, 15L), .Label = c("", "D1", "D1T1", "D1T2",
"D2", "D2D", "D2T1", "D2T1D", "D2T2", "D3", "D3T1", "D3T1D",
"D4", "D4T1D", "D5", "D5T1D", "D6"), class = "factor"), Joining = structure(c(1L,
7L, 8L, 8L, 4L, 8L, 1L, 9L, 1L, 8L), .Label = c("J1", "J1T1",
"J1T2", "J2", "J2D", "J2T1", "J3", "J4", "J5", "J6D"), class = "factor")), row.names = c(NA,
10L), class = "data.frame")