Create a new string from existing strings in different variables

0 votes

How to create a new string from existing strings in different variables?

There are 2 columns x and y. I want to form a new variable as below. Here x and y are string values in the data source.

Employee x has performed y in his/her probation.

Oct 16 in Data Analytics by ch
• 3,290 points

edited Oct 16 by ch 14 views

1 answer to this question.

0 votes

Its quite simple, Use paste function as below.

Where l = list(1:3) or c(1:3)

> lapply(l, function(x) {paste("I scored",x,"marks in Exam",sep = " ")})
[[1]]
[1] "I scored 1 marks in Exam"

[[2]]
[1] "I scored 2 marks in Exam"

[[3]]
[1] "I scored 3 marks in Exam"
answered Oct 31 by Cherukuri
• 31,840 points

Related Questions In Data Analytics

0 votes
1 answer

How to create dummy variables based on a categorical variable of lists in R?

You can use mtabulate in the following way: library(qdapTools) cbind(data[1], ...READ MORE

answered Apr 13, 2018 in Data Analytics by CodingByHeart77
• 3,690 points
576 views
0 votes
1 answer

How to create a new R6 Class in R?

You have to first create an object ...READ MORE

answered Jul 5, 2018 in Data Analytics by DataKing99
• 8,130 points
150 views
0 votes
1 answer
0 votes
0 answers

Split a string and store it in multiple columns from a field in R

How to Split a string and store ...READ MORE

Jun 28 in Data Analytics by Anand
41 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
116 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
160 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points
87 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,720 points
104 views
0 votes
1 answer

How to create a new table in database from R?

Use dbGetQuery to create a table by ...READ MORE

answered Oct 14 in Data Analytics by Cherukuri
• 31,840 points
23 views
0 votes
1 answer

Create a tree model in R from data.frame?

See the below example to understand how ...READ MORE

answered Aug 30 in Data Analytics by anonymous
• 31,840 points
56 views