Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205491

How to add zero to the string using regexp to get a length of 4 (from the beginning to the point)?

$
0
0

I have a vector:

x<-c("1. Ure.html", "15. Astra basta.html", "16. Mafa of Part 4.html", "16.1 Veka--Cons.pdf")

How do i get vector y using regexp? I need add lead zero to string for length 4 from start to point.

y<-c("0001. Ure.html", "0015. Astra basta.html", "0016. Mafa of Part 4.html", "0016.1 Veka--Cons.pdf")

Viewing all articles
Browse latest Browse all 205491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>