# Load your example data
q.data<-data.frame(number=1:3, string=c("greatgreat", "magic", "not"), stringsAsFactors = F)
library(stringr)
# Count the number of 'a's in each element of string
q.data$number.of.a <- str_count(q.data$string, "a")
q.data
# number string number.of.a
#1 1 greatgreat 2
#2 2 magic 1
#3 3 not 0
Code Example |
---|
R :: adding new key in R dictionary |
R :: Add tab in string r |
R :: select last child with class in r |
R :: logistic inverse CDF in r |
R :: r ggplot variable name |
R :: norm,s,inv in r |
R :: stacked bar plot r with age groups |
R :: R test if variable is NA |
R :: save link tweet in new column in R |
R :: how the print backslash in r |
R :: comparing pairs in r |
R :: mean of a row dataframe in r |
Rust :: get random enum rust |
Rust :: array as a parameter rust |
Rust :: rust request get headers |
Rust :: read file rust |
Rust :: rust file extension |
Rust :: ndarray rust |
Rust :: armanriazi•rust•smartpointer•box•cons |
Rust :: does rust support classes |
Rust :: rust•armanriazi•borrowchecker•borrow |
Rust :: armanriazi•rust•reference•dangle |
Rust :: armanriazi•rust•stack•vs•heap |
Rust :: rustdoc |
Rust :: armanriazi•rust•smartpointer•box•vs•rc•vs•refcell |
Lua :: lua how to get random object from a table |
Lua :: how to print hello in lua |
Lua :: lua for loop |
Lua :: roblox what is humanoid |
Lua :: lua object |