I got a .txt file which has sign at the end of the number.
When I tried converting it into numeric, the -ve values are turning into NA as the data is in character format. I even tried, flagging those -ve values and multiplying flagged value by '-1'.
Since I have around 25 such columns. It is getting complicated. Can anyone suggest me simple way to do this.
Below is the sample data I prepared,
R1 <- c("15515.88-","5156.04","65656","1566.1-")
R2 <- c("515","5156.11-","415-","1455-")
R3 <- c("123.14-","9875-","1247-","778.04-")
df <- data.frame(R1,R2,R3)
My expected output is -ve symbol at the initial,
R1 R2 R3
-15515.88 515 -123.14
5156.04 -5156.11 -9875
65656 -415 -1247
-1566.1 -1455 -778.04
Your kind help is needed