Hi there,
I have a huge dataframe containing 70,000 observations.
I have filtered this dataframe (let it's name be
"transformed_dataframe") as I wanted to select only those observations
which are greater than or equal to 60,001 regarding the very first identity
column.
So I have a transformed dataframe now including 10,000 obeservations (from
60,001 - to 70,000) and if you send "head(transformed_dataframe)" into
R it looks like this:
variable1 variable2 variable3
variable4 ...
60 001 ... ... ...
...
60 002 ... ... ...
...
60 003 ... ... ...
...
60 004 ... ... ...
...
60 005 ... ... ...
...
Sending "tail(transformed_dataframe)" into R it is going to be
something like:
variable1 variable2 variable3
variable4 ...
69 996 ... ... ...
...
69 997 ... ... ...
...
69 998 ... ... ...
...
69 999 ... ... ...
...
70 000 ... ... ...
...
Now is there a quick way to alter this indexing of rows in case of my
"transformed_dataframe"? I mean, I would like to get indices 1, 2, 3,
etc... instead of 60 001, 60 002, 60 003 etc...
So by sending "head(transformed_dataframe)" and
"tail(transformed_dataframe)" I would like to see:
variable1 variable2 variable3
variable4 ...
1 ... ... ...
...
2 ... ... ...
...
3 ... ... ...
...
4 ... ... ...
...
5 ... ... ...
...
and
variable1 variable2 variable3
variable4 ...
9 996 ... ... ...
...
9 997 ... ... ...
...
9 998 ... ... ...
...
9 999 ... ... ...
...
10 000 ... ... ...
...
Thank you very much, best regards,
Laszlo
____________________________________________________________________________________________________
Ez az e-mail és az összes hozzá tartozó csatolt melléklet titkos és/vagy
jogilag, szakmailag vagy más módon védett információt tartalmazhat. Amennyiben
nem Ön a levél címzettje akkor a levél tartalmának közlése, reprodukálása,
másolása, vagy egyéb más úton történő terjesztése, felhasználása szigorúan
tilos. Amennyiben tévedésből kapta meg ezt az üzenetet kérjük azonnal értesítse
az üzenet küldőjét. Az Erste Bank Hungary Zrt. (EBH) nem vállal felelősséget az
információ teljes és pontos - címzett(ek)hez történő - eljuttatásáért, valamint
semmilyen késésért, kapcsolat megszakadásból eredő hibáért, vagy az információ
felhasználásából vagy annak megbízhatatlanságából eredő kárért.
Az üzenetek EBH-n kívüli küldője vagy címzettje tudomásul veszi és hozzájárul,
hogy az üzenetekhez más banki alkalmazott is hozzáférhet az EBH folytonos
munkamenetének biztosítása érdekében.
This e-mail and any attached files are confidential and/...{{dropped:19}}
Bodnar Laszlo EB_HU <Laszlo.Bodnar <at> erstebank.hu> writes:> [snip snip ]> So I have a transformed dataframe now including 10,000 obeservations > (from 60,001 - to 70,000) and if you send > "head(transformed_dataframe)" into R it looks like this:[snip] >> Now is there a quick way to alter this indexing of rows in case of > my "transformed_dataframe"? I mean, I wouldrownames(newdata) <- 1:nrow(newdata)
On Apr 18, 2011, at 9:02 AM, Bodnar Laszlo EB_HU wrote:> Hi there, > > I have a huge dataframe containing 70,000 observations. > > I have filtered this dataframe (let it's name be > "transformed_dataframe") as I wanted to select only those > observations which are greater than or equal to 60,001 regarding the > very first identity column.I am guessing that what you want is something like dfrm2 <- transformed_dataframe[rownames(transformed_dataframe) >= "60001" , ] Or perhaps (if you carrying the thousands separator into the rownames: dfrm2 <- transformed_dataframe[rownames(transformed_dataframe) >= "60,001" , ] Or if you are using spaces then: dfrm2 <- transformed_dataframe[rownames(transformed_dataframe) >= "60 001" , ] This would involve much less guessing if you offered the results of: str(transformed_dataframe)> > So I have a transformed dataframe now including 10,000 obeservations > (from 60,001 - to 70,000) and if you send > "head(transformed_dataframe)" into R it looks like this: > > variable1 variable2 > variable3 variable4 ... > 60 > 001 > ... ... ... ... > 60 > 002 > ... ... ... ... > 60 > 003 > ... ... ... ... > 60 > 004 > ... ... ... ... > 60 > 005 > ... ... ... ... > > Sending "tail(transformed_dataframe)" into R it is going to be > something like: > > variable1 variable2 > variable3 variable4 ... > 69 > 996 > ... ... ... ... > 69 > 997 > ... ... ... ... > 69 > 998 > ... ... ... ... > 69 > 999 > ... ... ... ... > 70 > 000 > ... ... ... ... > > > Now is there a quick way to alter this indexing of rows in case of > my "transformed_dataframe"? I mean, I would like to get indices 1, > 2, 3, etc... instead of 60 001, 60 002, 60 003 etc...rownames(transformed_dataframe) <- 1:10000> > So by sending "head(transformed_dataframe)" and > "tail(transformed_dataframe)" I would like to see: > > variable1 variable2 > variable3 variable4 ... > 1 > ... ... ... ... > 2 > ... ... ... ... > 3 > ... ... ... ... > 4 > ... ... ... ... > 5 > ... ... ... ... > > and > > variable1 variable2 > variable3 variable4 ... > 9 > 996 > ... ... ... ... > 9 > 997 > ... ... ... ... > 9 > 998 > ... ... ... ... > 9 > 999 > ... ... ... ... > 10 > 000 > ... ... ... ... > > Thank you very much, best regards, > > Laszlo > ______________________________________________________________________________________________David Winsemius, MD West Hartford, CT
row.names(transformed_dataframe) <- NULL 2011/4/18 Bodnar Laszlo EB_HU <Laszlo.Bodnar at erstebank.hu>:> Hi there, > > I have a huge dataframe containing 70,000 observations. > > I have filtered this dataframe (let it's name be "transformed_dataframe") as I wanted to select only those observations which are greater than or equal to 60,001 regarding the very first identity column. > > So I have a transformed dataframe now including 10,000 obeservations (from 60,001 - to 70,000) and if you send "head(transformed_dataframe)" into R it looks like this: > > ? ? ? ? ? ? ? ? ? ? ? ?variable1 ? ? ? ? ? variable2 ? ? ? ? ? variable3 ? ? ? ? ? variable4 ? ? ? ? ? ... > 60 001 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 60 002 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 60 003 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 60 004 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 60 005 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > > Sending "tail(transformed_dataframe)" into R it is going to be something like: > > ? ? ? ? ? ? ? ? ? ? ? ?variable1 ? ? ? ? ? variable2 ? ? ? ? ? variable3 ? ? ? ? ? variable4 ? ? ? ? ? ... > 69 996 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 69 997 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 69 998 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 69 999 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > 70 000 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ? ... ? ? ? ? ? ? ? ? ? ?... > > > Now is there a quick way to alter this indexing of rows in case of my "transformed_dataframe"? I mean, I would like to get indices 1, 2, 3, etc... instead of 60 001, 60 002, 60 003 etc... > > So by sending "head(transformed_dataframe)" and "tail(transformed_dataframe)" I would like to see: > > ? ? ? ? ? ?variable1 ? ? ? ? ? variable2 ? ? ? ? ? variable3 ? ? ? ? ? variable4 ? ? ? ? ? ... > 1 ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 2 ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 3 ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 4 ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 5 ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > > and > > ? ? ? ? ? ? ? ? ? ? ? ?variable1 ? ? ? ? ? variable2 ? ? ? ? ? variable3 ? ? ? ? ? variable4 ? ? ? ? ? ... > 9 996 ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 9 997 ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 9 998 ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 9 999 ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > 10 000 ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... ? ? ? ? ? ? ? ? ? ?... > > Thank you very much, best regards, > > Laszlo > ____________________________________________________________________________________________________ > Ez az e-mail ?s az ?sszes hozz? tartoz? csatolt mell?klet titkos ?s/vagy jogilag, szakmailag vagy m?s m?don v?dett inform?ci?t tartalmazhat. Amennyiben nem ?n a lev?l c?mzettje akkor a lev?l tartalm?nak k?zl?se, reproduk?l?sa, m?sol?sa, vagy egy?b m?s ?ton t?rt?n? terjeszt?se, felhaszn?l?sa szigor?an tilos. Amennyiben t?ved?sb?l kapta meg ezt az ?zenetet k?rj?k azonnal ?rtes?tse az ?zenet k?ld?j?t. Az Erste Bank Hungary Zrt. (EBH) nem v?llal felel?ss?get az inform?ci? teljes ?s pontos - c?mzett(ek)hez t?rt?n? - eljuttat?s??rt, valamint semmilyen k?s?s?rt, kapcsolat megszakad?sb?l ered? hib??rt, vagy az inform?ci? felhaszn?l?s?b?l vagy annak megb?zhatatlans?g?b?l ered? k?r?rt. > > Az ?zenetek EBH-n k?v?li k?ld?je vagy c?mzettje tudom?sul veszi ?s hozz?j?rul, hogy az ?zenetekhez m?s banki alkalmazott is hozz?f?rhet az EBH folytonos munkamenet?nek biztos?t?sa ?rdek?ben. > > > This e-mail and any attached files are confidential and/...{{dropped:19}} > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve?
On 2011-04-18 06:15, Ben Bolker wrote:> Bodnar Laszlo EB_HU<Laszlo.Bodnar<at> erstebank.hu> writes: > >> [snip snip ] > >> So I have a transformed dataframe now including 10,000 obeservations >> (from 60,001 - to 70,000) and if you send >> "head(transformed_dataframe)" into R it looks like this: > > [snip]> > >> Now is there a quick way to alter this indexing of rows in case of >> my "transformed_dataframe"? I mean, I would > > > rownames(newdata)<- 1:nrow(newdata)or, perhaps a bit simpler rownames(newdata) <- NULL Peter Ehlers