[R] Question On Regex and DataFrame
bgunter.4567 at gmail.com
Mon Feb 22 04:02:12 CET 2016
On Sunday, February 21, 2016, kalyan chakravarty <
kalyanchakravarty456 at gmail.com> wrote:
> 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
False. You need to spend more time with a tutorial or two, as your initial
"understanding" is already incorrect. The rstudio.com website has some nice
suggestions for web tutorials, though you can certainly find many just by
Your questions below are essentially nonsense, because you do not
understand the data frame concept.
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
> 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
> Sorry if this is a basic question.
> Thank you
> [[alternative HTML version deleted]]
> more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
[[alternative HTML version deleted]]
More information about the R-help