6
#8 30 73 12
#9 89 67 8
#10 11 8 97
A.K.
- Original Message -----
From: Silvano Cesar da Costa
To: arun
Cc:
Sent: Thursday, November 8, 2012 3:22 PM
Subject: Re: [R] Extracting columns
Thanks Arun, but the columns need be unique.
> # Arun:
> list1 <- lapply(1:5, f
- Original Message -
From: Silvano Cesar da Costa
To: r-help@r-project.org
Cc:
Sent: Thursday, November 8, 2012 10:50 AM
Subject: [R] Extracting columns
Hi,
I have 22 files (A1, A2, ..., A22) with different number of columns,
totaling 10,000 columns: c1, c2, c3, ..., c1
I have a
Hello,
Something like this should get you close.
filenames <- paste0("A", 1:22)
cols <- c('c1', 'c50', 'C750')
lapply(filenames, function(x){
dat <- read.table(x, header = TRUE)
subset(dat, select = which(names(dat) %in% cols))
})
Hope this helps,
Rui Barradas
Em 08-11-2012 15:50, S
Hi,
I have 22 files (A1, A2, ..., A22) with different number of columns,
totaling 10,000 columns: c1, c2, c3, ..., c1
I have another file with a list of 100 columns that I need to extract.
These 100 columns are distributed in 22 files.
How to extract the 100 columns of the 22 files?
I have
On Aug 22, 2011, at 1:45 PM, Dennis Murphy wrote:
Hi:
You need a leading ^ in your grep string. Here's a reproducible
example to illustrate:
df <- data.frame(Xyz1 = rnorm(5), Xyz2 = rnorm(5), Xyz3 = rnorm(5),
Abc1 = rnorm(5), Abc2 = rnorm(5))
df[, grep('^Xyz', names(df))]
df[
Hi:
You need a leading ^ in your grep string. Here's a reproducible
example to illustrate:
df <- data.frame(Xyz1 = rnorm(5), Xyz2 = rnorm(5), Xyz3 = rnorm(5),
Abc1 = rnorm(5), Abc2 = rnorm(5))
df[, grep('^Xyz', names(df))]
df[, grep('^Abc', names(df))]
HTH,
Dennis
On Mon, Aug
Sorry, my mistake. The thing is that the command return no results at
all. However, when I just tried a simpler version of this (I had no
capital letters or no spaces in the string), it worked fine. I cant
figure it out, I think it all boils down to the fact that I'm no
expert at regexp's...
On
Can you say a little more about what you mean "it does not work"? I'd guess
you have a regular expression mistake and are probably getting more columns
than desired, but without an example, it's hard to be certain.
Use dput() and head() to give a small cut-and-paste-able example.
Michael
On Mon,
Hi,
Let's say that I have a set of column names that begin with the string
"Xyz". How do I extract these specific columns? I tried to do the
following:
dataframe1[,grep("Xyz",colnames(dataframe1))]
But it does not work. What is wrong with my expression?
_
Hi,
Here is the prcomp output.
tom=prcomp(matrix(rnorm(25),5,5))
R functions often output lists. To see what's in this one, run
"names(tom)" or type "tom$" and use tab completion. Once you do that,
the following is more obvious.
pc1=tom$rotation[,1]
sd1=tom$sdev[1]
column=c(sd1,pc1)
write.tabl
Hi list,
I am not a frequent user of R. Recently I used R in principal
component analysis and got the result as a class, which has information like
standard deviation and principal components from 1 to 10. How is it
possible to extract the column corresponding to first principal compon
On Aug 28, 2010, at 1:24 PM, Laetitia Schmid wrote:
Hi,
Can anybody show me how to extract all columns in my dataset that
are polymorphic? Or phrased in another way I would like to delete
all columns that have no more than one letter in it (that are
monomorphic).
Assuming you read this
Wow. That was fast. And it works. Thank you!
Laetitia
Am 29.08.2010 um 00:35 schrieb Jorge Ivan Velez:
> index <- apply(d, 2, function(x) length(table(x)) > 1)
> d[, index]
[[alternative HTML version deleted]]
__
R-help@r-project.org mailin
Hi,
Can anybody show me how to extract all columns in my dataset that are
polymorphic? Or phrased in another way I would like to delete all
columns that have no more than one letter in it (that are monomorphic).
Thank you.
Laetitia
"V1" "V2" "V3" "V4" "V5" "V6" "V7" "V8" "V9" "V10" "V11" "
On Thu, Jan 14, 2010 at 1:57 PM, Dennis Murphy wrote:
> Try this:
>
> nms <- paste("BOUTLENGTHTOT", 1:17, sep = "")
> data[, nms]
>
On Thu, Jan 14, 2010 at 2:08 PM, Peter Ehlers wrote:
> Try
>
> dat[names(dat) %in% paste("BOUTLENGTHTOT", 1:17, sep="")]
>
Thanks! Both methods worked.
--Mar
Try
dat[names(dat) %in% paste("BOUTLENGTHTOT", 1:17, sep="")]
-Peter Ehlers
Martin Striz wrote:
Hi folks, I'm new to the list.
I have a data file with 256 columns. Here's just a subset of names(data):
[1] "MOUSE" "BASEDATE1" "PERCENTSLEEPTOT1"
[4] "PERCENTSLEEPN
Try this:
DF[,grep("BOUTLENGTHTOT", l)]
On Thu, Jan 14, 2010 at 4:43 PM, Martin Striz wrote:
> Hi folks, I'm new to the list.
>
> I have a data file with 256 columns. Here's just a subset of names(data):
>
> [1] "MOUSE" "BASEDATE1" "PERCENTSLEEPTOT1"
> [4] "PERCENTSLEE
Hi folks, I'm new to the list.
I have a data file with 256 columns. Here's just a subset of names(data):
[1] "MOUSE" "BASEDATE1" "PERCENTSLEEPTOT1"
[4] "PERCENTSLEEPNIGHT1" "PERCENTSLEEPDAY1""BOUTLENGTHTOT1"
[7] "BOUTLENGTHNITE1" "BOUTLENGTHDAY1" "BOUT
Le ven. 23 mai à 09:37, mohamed nur anisah a écrit :
Dear all,
i have 2 lists of data with each of the list contain 14 columns.
No, you have one list with two elements; each is a 14-column data frame.
How am i going to extract column 12 and 13 from each of the list ??
Let's call your lis
I forgot to answer to the last part of your question.
I think what you call a list is actually an element of a list, right?
If so, the command you want depends on the way you want to combine these
elements.
For example, the following lines will extract columns 12 and 13 of any
array-like element o
Hi Mohamed
Try:
lapply (NameOfYourList, function (dat, NumCol) dat[,NumCol], c(12,13))
But there must be a shorter way to write this.
Nael
On Fri, May 23, 2008 at 3:37 PM, mohamed nur anisah <
[EMAIL PROTECTED]> wrote:
> Dear all,
>
> i have 2 lists of data with each of the list contain 14 c
Dear all,
i have 2 lists of data with each of the list contain 14 columns. How am i
going to extract column 12 and 13 from each of the list ?? and can i combine my
extracted columns to form a single list. Attach with are my data. Your
coorperation is highly appreciated. Many thanks
R
22 matches
Mail list logo