a b/man/extract_descriptions_counts.Rd
1
% Generated by roxygen2: do not edit by hand
2
% Please edit documentation in R/EnrichCircoBar.R
3
\name{extract_descriptions_counts}
4
\alias{extract_descriptions_counts}
5
\title{Extract and Count Descriptions with Specified Color}
6
\usage{
7
extract_descriptions_counts(df, descriptions, color)
8
}
9
\arguments{
10
\item{df}{A data frame containing at least 'Description' and 'Count' columns.}
11
12
\item{descriptions}{A vector of descriptions to filter in the data frame.}
13
14
\item{color}{A character string specifying the color to be added as a new column.}
15
}
16
\value{
17
A data frame filtered by descriptions, containing 'Description', 'Count', and a new 'color' column.
18
}
19
\description{
20
This function filters a data frame for specified descriptions, selects the 'Description' and 'Count' columns,
21
and adds a new column with a specified color.
22
}
23
\examples{
24
# Generate Sample Input Data for extract_descriptions_counts Function
25
26
# Create a sample data frame with 'Description' and 'Count' columns
27
data <- data.frame(
28
  Description = c(
29
    "immunoglobulin production",
30
    "B cell mediated immunity",
31
    "T cell activation",
32
    "antigen processing and presentation",
33
    "cytokine signaling",
34
    "natural killer cell activity",
35
    "phagocytosis",
36
    "complement activation",
37
    "antibody-dependent cellular cytotoxicity",
38
    "regulatory T cell function"
39
  ),
40
  Count = c(
41
    150,  # immunoglobulin production
42
    200,  # B cell mediated immunity
43
    175,  # T cell activation
44
    125,  # antigen processing and presentation
45
    190,  # cytokine signaling
46
    160,  # natural killer cell activity
47
    140,  # phagocytosis
48
    180,  # complement activation
49
    130,  # antibody-dependent cellular cytotoxicity
50
    170   # regulatory T cell function
51
  ),
52
  stringsAsFactors = FALSE  # Ensure that strings are not converted to factors
53
)
54
55
56
57
descriptions_to_filter <- c("immunoglobulin production", "B cell mediated immunity")
58
specified_color <- "red"  # You can specify any color you desire
59
filtered_data_with_color <- extract_descriptions_counts(
60
  data, descriptions_to_filter,
61
  specified_color)
62
print(filtered_data_with_color)
63
64
}