On 15/10/14 04:09, Kate Ignatius wrote:
In the sense - it does not work. it works when there are 50 samples
in the file, but it does not work when there is one.
The usual headings are: sample1.at sample1.dp
sample1.fg sample2.at sample2.dp sample2.fg and so on to a max of
sample50.at sampl
In the sense - it does not work. it works when there are 50 samples
in the file, but it does not work when there is one.
The usual headings are: sample1.at sample1.dp
sample1.fg sample2.at sample2.dp sample2.fg and so on to a max of
sample50.at sample50.dp sample50.fg
using this greps out a
You're right. I don't use regexps in R very much. In most other
languages, a single \ is needed. The R parser is different and I
forgot. Thanks for the heads up.
On Tue, Oct 14, 2014 at 10:01 AM, Ivan Calandra
wrote:
> Shouldn't it be
> grep("\\.at$",colnames(df))
> with double back slash?
>
> Iv
AT and at are not the same. If you want an case insensitive compare
for the characters "at" you need the "ignore.case=TRUE" added. E.g.:
df[,grep(".at",colnames(df),ignore.case=TRUE)
That should match the column name you gave. Which does not match your
initial description which said "ending with
Shouldn't it be
grep("\\.at$",colnames(df))
with double back slash?
Ivan
--
Ivan Calandra
University of Reims Champagne-Ardenne
GEGENA² - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
https://www.researchgate.net/profile/Ivan_Calandr
Your question is missing a reproducible example, and you don't say how it does
not work, so we cannot tell what is going on.
Two things do come to mind, though.
A) Data frame subsets with only one column by default return a vector, which is
a different type of object than a single-column data f
For example,
DF will usually have numerous columns with sample1.at sample1.dp
sample1.fg sample2.at sample2.dp sample2.fg and so on
I'm running this code in R as part of a shell script which runs over
several different file sizes so sometimes it will come across a file
with one sample in it:
On Tue, Oct 14, 2014 at 9:23 AM, Kate Ignatius wrote:
> I'm having an issue with grep:
>
> I have numerous columns that end with .at... when I use grep like so:
>
> df[,grep(".at",colnames(df))]
>
> it works fine. When I have one column that ends with .at, it does not
> work. Why is that? As th
I'm having an issue with grep:
I have numerous columns that end with .at... when I use grep like so:
df[,grep(".at",colnames(df))]
it works fine. When I have one column that ends with .at, it does not
work. Why is that? As this is loop with varying number of columns
ending in .at I would like
9 matches
Mail list logo