Use paste
.
df$x <- paste(df$n,df$s)
df
# n s b x
# 1 2 aa TRUE 2 aa
# 2 3 bb FALSE 3 bb
# 3 5 cc TRUE 5 cc
More Related Contents:
- Reshaping data.frame from wide to long format
- Dynamically select data frame columns using $ and a character value
- The difference between bracket [ ] and double bracket [[ ]] for accessing the elements of a list or dataframe
- Numbering rows within groups in a data frame
- Simultaneously merge multiple data.frames in a list
- Calculate the mean by group
- Select the row with the maximum value in each group
- Count number of rows within each group
- Remove rows with all or some NAs (missing values) in data.frame
- Drop unused factor levels in a subsetted data frame
- Split data.frame based on levels of a factor into new data.frames
- Combine a list of data frames into one data frame by row
- Combine two data frames by rows (rbind) when they have different sets of columns
- Counting unique / distinct values by group in a data frame
- How to split a data frame?
- Why is it not advisable to use attach() in R, and what should I use instead?
- Create an empty data.frame
- How to plot all the columns of a data frame in R
- Sample random rows in dataframe
- Extracting specific columns from a data frame
- Subset / filter rows in a data frame based on a condition in a column
- Rename multiple columns by names
- Convert data.frame column format from character to factor
- apply a function over groups of columns
- Convert a dataframe to a vector (by rows)
- Dollar sign before a variable
- R: Replace multiple values in multiple columns of dataframes with NA
- Should I use a data.frame or a matrix?
- Re-ordering factor levels in data frame [duplicate]
- Convert list to data frame while keeping list-element names