How to remove certain character from a vector

0 votes

I have a vector which looks something like this, c(61,33,"67*",98,"32*", "73*"). I need to clean the data using R by transforming this into a vector without the extra *. The result in this example should be c(61,33,67,98,32,73).

Nov 14, 2018 in Data Analytics by Ali
• 11,270 points
91 views

1 answer to this question.

0 votes

We can use sub to remove the * by specifying fixed = TRUE as it is a metacharacter that denotes zero or more characters.

answered Nov 14, 2018 by Maverick
• 10,820 points

Related Questions In Data Analytics

0 votes
4 answers

How to remove NA values from a Vector in R?

You can try na.omit() or na.exclude() too. ...READ MORE

answered Jul 31, 2019 in Data Analytics by anonymous
• 32,490 points
62,478 views
0 votes
1 answer

How to create a tree like structure from R list/vector?

Hi, puja. Use below function to create a ...READ MORE

answered Aug 30, 2019 in Data Analytics by anonymous
• 32,490 points
87 views
0 votes
1 answer
0 votes
1 answer

How to access the last value from a vector in R?

Hi@akhtar, You can use the tail function in ...READ MORE

answered Oct 30 in Data Analytics by MD
• 77,580 points
10 views
+1 vote
1 answer
+1 vote
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 32,490 points
493 views
0 votes
1 answer

Replace comma with a period in data cleaning using R

You can use the scan function in ...READ MORE

answered Nov 13, 2018 in Data Analytics by Maverick
• 10,820 points
1,232 views
0 votes
1 answer

Look for certain values from not cleaned data

First see what rows meet t$ps04==1 & t$rectyp==1. ...READ MORE

answered Nov 13, 2018 in Data Analytics by Maverick
• 10,820 points
73 views
0 votes
1 answer

How do I remove unnecessary redundant data from a dataset?

You can use dimensionality reduction methods such as ...READ MORE

answered Nov 13, 2018 in Data Analytics by Maverick
• 10,820 points
239 views
+1 vote
1 answer

How do i send R errors from console to standard java output?

R offers a command to save its ...READ MORE

answered Nov 8, 2018 in Data Analytics by Maverick
• 10,820 points
105 views