substring of last N characters in R

0 votes
How to store substring of last N characters from a data frame field in R?
Jun 28 in Data Analytics by Rajita
27 views

1 answer to this question.

0 votes

Use below code - 

If the elements within the field have fixed length then directly give the position values like below - 

substring(table$field_name,4,8)

If the length of elements in the field is varying then use nchar() to find the length of string like below -

substring(table$field_name,nchar(table$field_name)-4,nchar(table$field_name))
answered Jul 4 by anonymous
• 31,840 points

Related Questions In Data Analytics

0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,550 points
172 views
0 votes
1 answer
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
571 views
+1 vote
1 answer

How to convert a list of dataframes in to a single dataframe using R?

You can use the plyr function: data <- ...READ MORE

answered Apr 13, 2018 in Data Analytics by darklord
• 6,170 points
187 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
111 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
155 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
82 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
97 views
0 votes
2 answers

Top N and Last N records in R Data Frame

Hi, top_n( ) and top_frac( ) also is ...READ MORE

answered Sep 3 in Data Analytics by anonymous
• 31,840 points
43 views
0 votes
2 answers

Change data type of one column in R

You can change data types using as.* ...READ MORE

answered Aug 16 in Data Analytics by anonymous
• 31,840 points
136 views