Search
 
SCRIPT & CODE EXAMPLE
 

R

collapse text by group in dataframe r

# You want to aggregate text by group
df <- read.table(header=T, text="
group text
a a1
a a2
a a3
b b1
b b2
c c1
c c2
c c3
")

aggregate(df$text, list(df$group), paste, collapse="")
##   Group.1      x
## 1       a a1a2a3
## 2       b   b1b2
## 3       c c1c2c3
Comment

PREVIOUS NEXT
Code Example
R :: reverse row order dataframe R 
R :: tbale() in R 
R :: Error in value[[3L]](cond) : Package ‘lavaan’ version 0.6.8 cannot be unloaded: 
R :: r split string column by delimiter 
R :: r read all files in folder 
R :: merge multiple datatable in r 
R :: view table/dataframe in r 
R :: how to get the mode in r 
R :: rename column in r 
R :: reverse string in r 
R :: how to combine all columns into one column in r 
R :: correlation matrix in r 
R :: libpath r 
R :: R remove commas 
R :: r replace space with 
R :: what is a vector in r 
R :: make gif r 
R :: change the y ticks in r plot 
R :: knn accuracy in r 
R :: prediction of linear model at a single point in R 
R :: sparklyr alternative for str_detect 
R :: select last child with class in r 
R :: how to filter in R whitout lossing NA values 
R :: convert ratio to numeric in r 
R :: grep string that ends with R 
Rust :: rust field is never read remove warning 
Rust :: rust convert integer to string 
Rust :: push and item to vector rust 
Rust :: get os name rust 
Rust :: rust compiler 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =