[e25014]: / man / extract_descriptions_counts.Rd

Download this file

65 lines (57 with data), 2.1 kB

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