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,360 points
449 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,840 points

Related Questions In Data Analytics

0 votes
5 answers

How to remove NA values from a Vector in R?

Hello team, you can use na.omit x <- c(NA, 3, ...READ MORE

answered Dec 9, 2020 in Data Analytics by anonymous
• 82,880 points
191,501 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
• 33,030 points
684 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, 2020 in Data Analytics by MD
• 95,440 points
783 views
+1 vote
1 answer

How to standardize rows when cleaning data?

The goal of this step is to ...READ MORE

answered Nov 14, 2018 in Data Analytics by Maverick
• 10,840 points
524 views
+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
• 33,030 points
1,401 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,840 points
3,269 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,840 points
398 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,840 points
1,231 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,840 points
471 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP