0 votes

I have the following data

```1) 100      |  101.25  | 102.25. | .   | .. | 201.5. |
2) 200.05.  |  200.56. | 205     | ..  | .  | 3000   |
3) 300.98   |  300.26. | 2001.56.| ... | 0.2| 5.65.  |```

Expected output

```1) 100   | 101.25   | 102.25  |NA | NA |201.5
2) 200.05|200.26    | 205     |NA | NA |3000
3) 300.98|300.26    |2001.26  |NA |0.2 |5.65```
Nov 13, 2018 518 views

## 1 answer to this question.

0 votes

Just try removing the periods using sub function

```x <- c("101.25", "200.56.", "300.26")
x <- sub("\\.\$", "", x)```
answered Nov 13, 2018 by
• 10,840 points

0 votes
1 answer

## How to forecast season and trend of data using STL and ARIMA in R?

You can use the forecast.stl function for the ...READ MORE

0 votes
2 answers

## what are the different ways of getting/reading data into for cleaning

Most used functions for reading or extracting ...READ MORE

+1 vote
3 answers

## How to change the value of a variable using R programming in a data frame?

Try this: df\$symbol <- as.character(df\$symbol) df\$symbol[df\$sym ...READ MORE

0 votes
1 answer

## How to achieve pivot like data using tidyverse library in R?

You need not spread twice, if you ...READ MORE

0 votes
1 answer

## Replace comma with a period in data cleaning using R

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

0 votes
1 answer

## Cleaning a Data Frame Using Regexp in R

The simplest way: library(dplyr) library(stringi) df %>% mutate(NUMERO_APPEL.fix = ...READ MORE

0 votes
1 answer

## How do I remove unnecessary redundant data from a dataset?

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

0 votes
1 answer

## Manipulate character string using gsub() and perform multivariate data cleaning efficiently in R

gsubfn is perfect for this task: library(gsubfn) as.vector(sapply(gsubfn("[A-Z]", list(B="* 1", ...READ MORE

0 votes
1 answer

## Cleaning data using R

Try something like this: text1='"id","gender","age","category1","category2","category3","category4","category5","category6","category7","category8","category9","category10" 1,"Male",22,"movies","music","travel","cloths","grocery",,,,, 2,"Male",28,"travel","books","movies",,,,,,, 3,"Female",27,"rent","fuel","grocery","cloths",,,,,, 4,"Female",22,"rent","grocery","travel","movies","cloths",,,,, 5,"Female",22,"rent","online-shopping","utiliy",,,,,,,' d1 <- read.table(text=text1, sep=",", ...READ MORE

0 votes
1 answer

## Clean a set of data using R

Try this: NCM <- c(5,1,3,2,4) Mbrand <- c(1,5,3,4,2) fac<-factor(Mbrand, levels ...READ MORE