Hi,
I am new to R and learning the basics.so i came to know that data frame can
store any data type as oppose to matrix which stores only numeric.My
question is
1.)How to replace a particular pattern with new pattern in data frame.I
tried something like
x = as.data.frame(gsub(".*LINK.*","NA",file))........but the output is
really weird it converts every thing in zeros and ones.

what i actually want is DELETE ALL THE RANDOM COLUMS IN DF BASED ON ROW
VALUE.

file = read.csv("x.csv",header=T,sep=",")#read the file
file[file == "LINK"] = NA #replaced row pattern with NA
file[,colSums(is.na(file))==0] #deleting all colums which has na's

This approach pretty much does the thing but i want to get familiar on how
to use regular expressions over data frame.
Any suggestions on which function/package/regex to use when dealing with
DataFrame

Sorry if this is a basic question.
Thank you

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to