help with matrix
1
0
Entering edit mode
@alberto-goldoni-3477
Last seen 9.6 years ago
Dear All, if i have a dataframe "b" like this one: SHR1 SHR2 SHR3 WK1 WK2 1368290_at 7.680187 7.214491 7.156308 7.064027 4.496945 1368637_at 11.393928 11.337781 11.420565 11.464711 9.329639 1369202_at 7.766468 7.910206 7.553126 7.559352 4.169429 1370463_x_at 8.896523 8.865356 8.847850 8.830867 6.388185 1370806_at 9.754578 9.752164 9.718223 9.680127 11.756575 1370815_at 5.781366 5.799394 5.815935 5.847172 4.318191 1371033_at 5.063421 4.303661 4.598223 4.506666 8.297466 1371137_at 8.010640 7.737443 7.625425 7.629711 4.105173 1371960_at 7.293301 7.149758 6.960322 7.075571 9.944016 1372120_at 6.300269 6.252419 6.296085 6.219186 4.747452 and i would like to obtain another dataframe like this: GeneID SHR1 SHR2 SHR3 WK1 WK2 1 374 5.068725 4.833424 5.251337 9.105219 9.384213 2 2289 7.764840 7.842467 7.973488 11.285194 11.189364 3 10563 4.824265 4.780033 4.417243 8.362088 7.825695 4 687 4.607949 5.169052 4.947950 7.463272 7.370329 5 80149 7.729777 7.472989 7.617576 10.281806 9.541200 6 5033 9.111025 8.239996 8.677078 11.213525 10.343982 7 7088 5.782532 6.094321 6.069819 8.451878 8.442783 8 64764 9.669172 9.684598 9.922658 11.298087 11.198835 9 10628 10.555573 10.461917 11.067293 12.686023 12.624490 10 5087 8.535518 8.652258 8.576578 10.263172 9.893716 so the questions are: 1) how can i get the first colon (1,2,3......10) 2) how can i substitute the affyID with the GeneID 3) how can assembly the 1) and 2) columns in the first dataframe in order to obtain the second one. best regards -- ----------------------------------------------------- Dr. Alberto Goldoni Bologna, Italy
Colon Colon • 607 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 11 hours ago
United States
Hi Alberto, Alberto Goldoni wrote: > Dear All, > if i have a dataframe "b" like this one: > SHR1 SHR2 SHR3 WK1 > WK2 > 1368290_at 7.680187 7.214491 7.156308 7.064027 4.496945 > 1368637_at 11.393928 11.337781 11.420565 11.464711 9.329639 > 1369202_at 7.766468 7.910206 7.553126 7.559352 4.169429 > 1370463_x_at 8.896523 8.865356 8.847850 8.830867 6.388185 > 1370806_at 9.754578 9.752164 9.718223 9.680127 11.756575 > 1370815_at 5.781366 5.799394 5.815935 5.847172 4.318191 > 1371033_at 5.063421 4.303661 4.598223 4.506666 8.297466 > 1371137_at 8.010640 7.737443 7.625425 7.629711 4.105173 > 1371960_at 7.293301 7.149758 6.960322 7.075571 9.944016 > 1372120_at 6.300269 6.252419 6.296085 6.219186 4.747452 > > and i would like to obtain another dataframe like this: > > GeneID SHR1 SHR2 SHR3 WK1 WK2 > 1 374 5.068725 4.833424 5.251337 9.105219 9.384213 > 2 2289 7.764840 7.842467 7.973488 11.285194 11.189364 > 3 10563 4.824265 4.780033 4.417243 8.362088 7.825695 > 4 687 4.607949 5.169052 4.947950 7.463272 7.370329 > 5 80149 7.729777 7.472989 7.617576 10.281806 9.541200 > 6 5033 9.111025 8.239996 8.677078 11.213525 10.343982 > 7 7088 5.782532 6.094321 6.069819 8.451878 8.442783 > 8 64764 9.669172 9.684598 9.922658 11.298087 11.198835 > 9 10628 10.555573 10.461917 11.067293 12.686023 12.624490 > 10 5087 8.535518 8.652258 8.576578 10.263172 9.893716 > > so the questions are: > 1) how can i get the first colon (1,2,3......10) > 2) how can i substitute the affyID with the GeneID > 3) how can assembly the 1) and 2) columns in the first dataframe in > order to obtain the second one. The first column in your data.frame 'b' isn't a column - it's the row.names for the data.frame. Note that you don't give us much to go on, like the fact that you are using a rat2302 chip. A complete description of the problem will go far to help those who might help you. I will ignore questions 1 and 3 because I have no idea what you are asking for. > suppressMessages(library(rat2302.db)) > d <- data.frame(GeneID = unlist(mget(row.names(b), rat2302ENTREZID)), b) > d GeneID SHR1 SHR2 SHR3 WK1 WK2 1368290_at 83476 7.680187 7.214491 7.156308 7.064027 4.496945 1368637_at 64171 11.393928 11.337781 11.420565 11.464711 9.329639 1369202_at 286918 7.766468 7.910206 7.553126 7.559352 4.169429 1370463_x_at 414819 8.896523 8.865356 8.847850 8.830867 6.388185 1370806_at 246298 9.754578 9.752164 9.718223 9.680127 11.756575 1370815_at 24587 5.781366 5.799394 5.815935 5.847172 4.318191 1371033_at 309622 5.063421 4.303661 4.598223 4.506666 8.297466 1371137_at 252898 8.010640 7.737443 7.625425 7.629711 4.105173 1371960_at 313053 7.293301 7.149758 6.960322 7.075571 9.944016 1372120_at 300968 6.300269 6.252419 6.296085 6.219186 4.747452 If you really want to exchange your Affy IDs with numbers, see ?row.names. In addition, if you are really struggling with such simple data manipulation steps, you need to read (at the very least) 'An Introduction to R'. You can find that at the R home page, or by simply googling it. Best, Jim > > best regards > > > -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
ADD COMMENT

Login before adding your answer.

Traffic: 655 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