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
• 10,380 points
38 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,020 points

Related Questions In Data Analytics

0 votes
2 answers

How to remove NA values from a Vector in R?

data = data[!is.na(data)]\ READ MORE

answered Apr 5 in Data Analytics by anonymous
3,985 views
0 votes
1 answer

How to extract specific columns from a DataFrame ?

Yes there are so many ways: df[,c(V2,V4)] and another ...READ MORE

answered Apr 11, 2018 in Data Analytics by DeepCoder786
• 1,700 points
451 views
0 votes
1 answer

How to count the number of elements with the values in a vector?

You have various options to count the ...READ MORE

answered Apr 12, 2018 in Data Analytics by darklord
• 6,140 points
45 views
0 votes
1 answer

How to remove rows with missing values (NAs) in a data frame?

You can use complete.cases in the following ...READ MORE

answered Apr 13, 2018 in Data Analytics by darklord
• 6,140 points
3,300 views
0 votes
1 answer
0 votes
1 answer

How to sort a data frame by columns in R?

You can just use the order function ...READ MORE

answered Apr 10, 2018 in Data Analytics by darklord
• 6,140 points
60 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,020 points
21 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,020 points
16 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,020 points
28 views
0 votes
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,020 points
9 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.