Remove characters from field in dataframe

0 votes
I'm using superstore dataset from kaggle. Sales and profit column has $ symbol so R stored it as character datatype how to change it back to an integer data type. Can someone help
Oct 14, 2019 in Data Analytics by ch
• 3,450 points
1,940 views

1 answer to this question.

0 votes

Use the below code to update the sales and profit field data type and values.

superstore$Sales = substring(superstore$Sales,2)
superstore$Profit = substring(superstore$Profit,2)
# Change the data type as integer/ numeric
class(superstore$Sales) = "Numeric"
# Or
superstore$Sales= as.numeric(superstore$Sales)
answered Oct 14, 2019 by anonymous
• 33,030 points

Related Questions In Data Analytics

+1 vote
1 answer

How to convert dataframe columns from factors to characters?

To replace all the variables to character ...READ MORE

answered Apr 13, 2018 in Data Analytics by BHARANI
• 420 points
19,574 views
0 votes
1 answer

Reshape dataframe without “timevar” from long to wide format in R

Assuming that the data is in the ...READ MORE

answered Jun 14, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
1,005 views
+1 vote
1 answer

Remove NA values from the output in R programming

Edit your code: columnmean <- function(x, removeNA = ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 52,350 points
896 views
+1 vote
1 answer

Filter something from dataframe in an order in R

You can use conditional filtering for this ...READ MORE

answered Dec 13, 2018 in Data Analytics by Maverick
• 10,840 points
698 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
2,268 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
1,963 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, 2020 by Gitika 1,203 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
1,400 views
+1 vote
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,840 points
195,410 views
0 votes
1 answer

Read data from various csv and store it in one dataframe

Use rbind() to join both data frames ...READ MORE

answered Jul 4, 2019 in Data Analytics by anonymous
• 33,030 points
757 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