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, 2019 in Data Analytics by ch
• 3,380 points

edited Oct 16, 2019 by ch 44 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, 2019 by Cherukuri
• 32,460 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,710 points
933 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,150 points
326 views
0 votes
1 answer

How to create a 2D array of vectors of different lengths in R programming?

You can try making a list of matrices ...READ MORE

answered Feb 1, 2019 in Data Analytics by Sophie may
• 9,940 points
88 views
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, 2019 in Data Analytics by Anand
129 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
720 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
384 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

edited Jun 9 by Gitika 157 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
231 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, 2019 in Data Analytics by Cherukuri
• 32,460 points
504 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, 2019 in Data Analytics by anonymous
• 32,460 points
327 views