Correcting dataframe in R -
i have dataframe in elements of second column misplaced . example :
"15365","jas online services private limited" "15366","kress italian food specialties private limited" "15367","shatayu criticare hospital , research center pri vate limited" "15368","white hearts foodies private limited" "15369","maahi logistics private limited" ... ... "15376","g s life skills education worldwide private limite d" "15377","red line logistics private limited"
and on . here row 15367 , 15376 need editing . there way without doing manually ?
simply use quote
parameter of read.table
. suppose have string in variable ds
, want store resulting data.frame
in my.df
:
my.df <- read.table(text=ds, sep=",", quote="\"")
if want remove line breaks resulting column can use following code, replace replacement
text want replace linebreaks , v2
column name of data.frame
.
my.df$v2 <- gsub("\\n", replacement, my.df$v2)
Comments
Post a Comment