0

I'm reading in a csv file which is quite messy. It looks like tt.

a <- c("REQDO.,TRIBUNAL DE JUSTIÇA DO ESTADO DO RIO GRANDE DO SUL ,")
b <- c("29/05/1992 ,PUBLICADO ACORDAO DJ: , ,                         ,                           ,")
c <- c("23/04/1991 ,DECISAO PUBLICADA DJ: , ,        ")
d <- c("29/05/1992 ,PUBLICADO DESPACHO NO DJ , ,PROCEDO LIBERACAO PECAS P/ FORMALIZACAO ACORDAO                         ,                           ,")

tt <- rbind(a,b,c,d)
row.names(tt) <- NULL

For some reason I have to use sep=";" in order to be able to read the csv. If that wouldn't be the case I'd just read it in with sep="," but it seems that this is no option.

Now, I'd like to split this one column into three, that in the end tt looks like this:

V1          V2                                                     V3              
REQDO.      TRIBUNAL DE JUSTIÇA DO ESTADO DO RIO GRANDE DO SUL
29/05/1992  PUBLICADO ACORDAO DJ: 
23/04/1991  DECISAO PUBLICADA DJ:
29/05/1992  PUBLICADO DESPACHO NO DJ                               PROCEDO LIBERACAO PECAS P/ FORMALIZACAO ACORDAO

How can I do this? Thanks

Thomas
  • 1,392
  • 3
  • 22
  • 38

1 Answers1

2

You can try cSplit from splitstackshape

library(splitstackshape)
res <- cSplit(tt, 'V1', sep=',')
akrun
  • 874,273
  • 37
  • 540
  • 662