extracting specific columns from a table
2
0
Entering edit mode
dhaarini s ▴ 70
@dhaarini-s-3305
Last seen 10.2 years ago
Hi all! I am new to R. I have a table with 291 columns totally. I would just like to extract columns 1 to 5 and columns 243 to 291. I am now able to extract columns 1 to5 separately or columns 243 to 291 separately. But I am not able to extract together columns 1 to 5 and columns 243 to 291. The command which i gave was >datrma[,1:5] >datrma[,243:291](datrma is my object containing the table) Please suggest me a command so that i can extract these columns together. Expecting your reply. Thanks in advance! Regards, S.Dhaarini [[alternative HTML version deleted]]
• 1.2k views
ADD COMMENT
0
Entering edit mode
@saroj-k-mohapatra-3419
Last seen 10.2 years ago
Hi Dhaarini: You combine all the column indices to a new vector using the function "c" col.indices = c(1:5,243:291) newdat = datrma[,col.indices] Hope it helps, Saroj dhaarini s wrote: > Hi all! > I am new to R. I have a table with 291 columns totally. I would just like to > extract columns 1 to 5 and columns 243 to 291. I am now able to extract > columns 1 to5 separately or columns 243 to 291 separately. But I am not able > to extract together columns 1 to 5 and columns 243 to 291. > The command which i gave was > >> datrma[,1:5] >> datrma[,243:291](datrma is my object containing the table) >> > Please suggest me a command so that i can extract these columns together. > Expecting your reply. Thanks in advance! > Regards, > S.Dhaarini > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > >
ADD COMMENT
0
Entering edit mode
Thanks a lot! Regards, Dhaarini On Sat, May 2, 2009 at 9:43 PM, Saroj K Mohapatra <saroj@vt.edu> wrote: > Hi Dhaarini: > > You combine all the column indices to a new vector using the function "c" > > col.indices = c(1:5,243:291) > > newdat = datrma[,col.indices] > > Hope it helps, > > Saroj > > dhaarini s wrote: > >> Hi all! >> I am new to R. I have a table with 291 columns totally. I would just like >> to >> extract columns 1 to 5 and columns 243 to 291. I am now able to extract >> columns 1 to5 separately or columns 243 to 291 separately. But I am not >> able >> to extract together columns 1 to 5 and columns 243 to 291. >> The command which i gave was >> >> >>> datrma[,1:5] >>> datrma[,243:291](datrma is my object containing the table) >>> >>> >> Please suggest me a command so that i can extract these columns together. >> Expecting your reply. Thanks in advance! >> Regards, >> S.Dhaarini >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor@stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> >> > > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
ALok ▴ 170
@alok-2917
Last seen 10.2 years ago
use abc=append(1:5, seq(243,291), after=5) datrma[,abc] On Sat, May 2, 2009 at 3:21 PM, dhaarini s <dhaarini87@gmail.com> wrote: > Hi all! > I am new to R. I have a table with 291 columns totally. I would just like > to > extract columns 1 to 5 and columns 243 to 291. I am now able to extract > columns 1 to5 separately or columns 243 to 291 separately. But I am not > able > to extract together columns 1 to 5 and columns 243 to 291. > The command which i gave was > >datrma[,1:5] > >datrma[,243:291](datrma is my object containing the table) > Please suggest me a command so that i can extract these columns together. > Expecting your reply. Thanks in advance! > Regards, > S.Dhaarini > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- ALok Srivastava Ph.D scholar Centre of Computational Biology and Bioinformatics School of Information Technology JNU New Delhi [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 697 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6