Displaying 20 results from an estimated 40000 matches similar to: "Maximum Number of Rows in a Dataframe"
2009 Oct 13
2
splitting dataframe, assign to new dataframe, add new rows to new dataframe
Hi, all,
My objective is to split a dataframe named "cmbine" according to the value of "classes". After the split, I will take the first instance from each class and bin them into a new dataframe, "df1". In the 2nd iteration, I will take the 2nd available instance and bin them into another new dataframe, "df2".
>cmbine$names
apple tiger pencil chicken
2009 May 24
1
subset dataframe by number of rows of equal values
Hi R helpers!
I have the following dataframe ?choose?
choose<-data.frame(firm=c(1,1,2,2,2,2,3,3,4,4,4,4,4,4),
year=c(2000,2001,2000,2001,2002,2003,2000,2003,2001,2002,2003,2004,2005,2006),code=c(10,10,11,11,11,11,12,12,13,13,13,13,13,13))
choose
I want to subset it to obtain another one with those
observations for which there more than 2 observations in
the column ?code?. So I want a
2011 Jan 25
5
Counting number of rows with two criteria in dataframe
Hi R-users,
I'm trying to find an elegant way to count the number of rows in a dataframe
with a unique combination of 2 values in the dataframe. My data is
specifically one column with a year, one with a month, and one with a day.
I'm trying to count the number of days in each year/month combination. But
for simplicity's sake, the following dataset will do:
2009 May 26
2
Problem accessing "row number" from subset on a dataframe
I would like to use the "row number" information returned from performing a subset command on a dataframe.
For example, I would like to automatically delete some rows from a dataframe if they match a criteria. Here is my example below.
data(airquality)
names(airquality)
subset(airquality, airquality$Month == 6)
Now how do I delete the row numbers returned automatically?
I
2009 May 10
1
Select the rows in a dataframe that matches a criteria in another dataframe
Hi everyone! Thank you for the help you have been given to
me, and here I'm with another problem with my dataframes:
I have two dataframes (with much more observations), like
these:
Dataframe1
Firm Year cash
500400200 2007 100
500400200 2006 200
500400200 2005 400
500400300 2007 300
500400300 2006 240
500400300 2005 120
500400400
2004 Dec 13
0
How to duplicate rows in dataframe?
> x.1 <- data.frame(a=1:5, b=1:5)
> x.1
a b
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
> x.1[c(1,2,2,2,3,3,4,4,5,4,3,2,1),]
a b
1 1 1
2 2 2
2.1 2 2
2.2 2 2
3 3 3
3.1 3 3
4 4 4
4.1 4 4
5 5 5
4.2 4 4
3.2 3 3
2.3 2 2
1.1 1 1
>
__________________________________________________________
James Holtman "What is the problem you are trying to solve?"
Executive Technical
2011 Nov 06
1
Deleting rows dataframe in R conditional to “if any of (a specific variable) is equal to”
Dear list,
I have been struggling for some time now with this code... I have this vector of unique ID "EID" of length 821 extracted from one of my dataframe (skate). It looks like this:
> head(skate$EID)
[1] "896-19" "895-8" "899-1" "899-5" "899-8" "895-7"
I would like to remove the complete rows in another dataframe
2002 Nov 11
2
repeating a dataframe n times in the direction of the rows
Question:
How can a repeat a dataframe n times
in the direction of the rows?
(Or: How I can rbind a dataframe n times ?)
Example Data:
x <- data.frame( alpha=letters[1:3], num=1:3 )
n <- 4
Complicated solution: To rbind a dataframe n times I can program a loop:
xr <- x
for( i in 2:n ) xr <- rbind( xr, n )
Observation: To cbind a dataframe n times I
2003 Oct 09
2
AW: Getting rows from a dataframe
Df[x, ]
Read 'an introduction to R' and 'FAQ'
-----Urspr?ngliche Nachricht-----
Von: Mark Lee [mailto:mark.lee at orbisuk.com]
Gesendet: Donnerstag, 9. Oktober 2003 18:02
An: r-help at stat.math.ethz.ch
Betreff: [R] Getting rows from a dataframe
Sorry if this is a silly question. I'm trying to extract all elements of a dataframe at a particular row. I can find no mention
2010 Apr 03
1
"moving product", by rows, of a dataframe?
What is a "good" way to calculate the "moving product", for each row of a dataframe, where I wish to be able to specify the length of the moving product? Depending on my needs, I'd like to be able to specify the "length" over which to calculate the moving average (in this example, length=3).
For example, if I have a dataframe with 20 rows and 6 columns, and I
2004 Nov 29
2
proper way to process dataframe by rows
This is a best practices / style question.
The way I use RODBC is I something like this:
> foo <- sqlQuery(db, "select * from foo")
> apply(foo, 1, function{...})
That is, I use apply to iterate over each result -- row -- in the
RODBC-produced dataframe. Is this how one generally wants to do this?
My concern is that when apply iterates over the rows, it uses
as.matrix()
2003 Jan 23
1
subset dataframe based on rows
I want to subset the dataframe based on certain values in a row.
for each row in my dataframe
if ANY one value of a particular set of columns satisfies cond
append a logical value true at the end of the row
else
append a false at the end of the row
in the end I want to be able to subset the whole data based on the
appended true or false value.
I could literally code like this, but I think
2009 Jul 09
2
How to combine two rows (in a dataframe) into a third row?
Dear R-helpers,
I have two rows in my dataframe:
ID VALUE
1A 10
1B 15
and I would like to combine these two rows into a single (new) row in my
dataframe:
ID VALUE
1 25
...simply by specifying a new value for ID and summing the two VALUES.
I have been trying to do this with with rbind, but it's not working.
I'd appreciate any pointers.
Thanks, Mark Na
[[alternative
2011 Apr 28
1
Extract complete rows by group and maximum
Hi
I'm trying to extract complete rows from a dataframe by group based on
the maximum in a column within that group.
Thus I have a dataframe:
cvd_basestudy ... es_time ...
_____________
study1 ... 0.3091667
study2 ... 0.3091667
study2 ... 0.2625000
study3 ... 0.3033333
study3 ... 0.2625000
__________
etc
I can extract the basestudy and the max(es_time)
2008 Mar 07
4
locate the rows in a dataframe with some criteria
Hi, netters,
This is probably a rookie question but I couldn't find the answer after hours of searching and trying.
Suppose there'a a dataframe M:
x y
10 A
13 B
8 A
11 A
I want to locate the rows where x >=10 and y="A". I know how to do it to vectors by using
which, but how to do it with the dataframe?
Thank you very much!
Zhihua Li
2012 Apr 26
1
How to delete rows from dataframe that sum to zero
Hello,
I am trying to figure out how to delete all rows which sum to zero from a
dataframe. I do not have a column with the sum of each column yet, so
perhaps that would need to be done first? Thank you for any help anyone can
offer with this.
Emily
PS sorry if this question has already been answered in a previous thread, I
did look through them & one seemed relevant, but I couldn't
2009 Nov 23
1
using contents of one column to direct addition of new rows in dataframe
Hello, R gurus. I've been trying to get R to do some data manipulation
for me, and so far have been stumped in figuring out any elegant way
to do so. Searches through the R-help archive haven't helped, so now
I'm trying plan B.
Suppose I have a dataframe that summarizes events that took place
between some interval of time in days, "Time." I want to expand the
dataframe to
2006 Aug 22
1
Selection on dataframe based on order of rows
I have a dataframe with the following structure
id date value
-------------------------
1 22/08/2006 48
1 24/08/2006 50
1 28/08/2006 150
1 30/08/2006 100
1 01/09/2006 30
2 11/08/2006 30
2 22/08/2006 100
2 28/08/2006 11
2 02/09/2006 5
3 01/07/2006 3
3 01/08/2006 100
3 01/09/2006 100
4 22/08/2006
2000 Sep 03
1
removing rows from a dataframe
Hi,
I have a dataframe, hilodata, which looks like this:
> hilodata
sym date maxprice minprice ntick
1 ABK 19910711 11.1867461 0.0000000 108
2 ABK 19910712 11.5298979 11.1867461 111
3 ABK 19910715 11.7357889 11.4612675 52
4 ABK 19910716 11.5298979 11.3240068 51
5
2003 Oct 09
4
Getting rows from a dataframe
Sorry if this is a silly question. I'm trying to extract all elements
of a dataframe at a particular row. I can find no mention of this in
any documentation and it may be naivety of dataframe on my part as I'm
very green at this. Thankyou,
Mark