search for: yourframe

Displaying 9 results from an estimated 9 matches for "yourframe".

2011 Aug 01
1
Inserting column in between -- "better" way?
...o do this, either via base R or via an R package. I leave it to you to define "essentially better." Thanks. Cheers, Bert On Mon, Aug 1, 2011 at 10:17 AM, Bert Gunter <bgunter at gene.com> wrote: > Doesn't work -- you lose column names. > > Try this instead: > > yourframe[,30:51] <- cbind( newcolumn,yourframe[,30:50]) > > Adjust column names after via: > > names(yourframe) [30:51] <- c(newcolname,names(yourframe[30:50]) > > Cheers, > Bert > > On Mon, Aug 1, 2011 at 10:10 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote: >&...
2012 Oct 11
1
replacing ugly for loops
I have a couple of hundred American Community Survey Summary Files files containing rectangular arrays of data, mainly though not exclusively numeric. Each file is referred to as a sequence (henceforth "seq"). From these files I am trying to extract particular subsets (tables) consisting of a sets of columns. These tables are defined by three numbers (now in columns in a data frame):
2006 Feb 03
1
Using string vectors as for loop arguments
Is there a mechanism to interate through a vector of strings? Say I have a data frame of 50 variables (VAR1 to VAR50), each with 100 measurements along with some coding factors (EXP and DOSE). I want to calculate the mean of a subset of each of VAR1 to VAR 50 (selecting by EXP and DOSE). Rather than just copy/pasting the same code 50 times, I thought of using a for loop to go through a
2005 May 24
3
obtaining first and last record for rows with same identifier
I have a dataframe that contains fields such as patid, labdate, labvalue. The same patid may show up in multiple rows because of lab measurements on multiple days. Is there a simple way to obtain just the first and last record for each patient, or do I need to write some code that performs that. Thanks, Steven
2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12) dim(foo) <- c(30, 34, 12) I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame. I know how this can be done in a very slow way using for loops, like this: x <- rep(seq(from = 1, to = 30), 34) y <- as.vector(sapply(1:34, function(x) {rep(x, 30)})) month <- as.vector(sapply(1:12,
2004 Jul 19
10
How to compare X1 = X2 = ... = Xn?
Dear All, I have a data frame with n columns: X1, X2, ., Xn. Now I want to create a new column: if X1 = X2 = . = Xn, the value is 1; Otherwise, the value is 0. How to do that in a quick way instead of doing (n choose 2) comparisons? Thank you, Frank [[alternative HTML version deleted]]
2005 Dec 05
1
convert list to data frame
Dear R users: I've a list containing parameters (A , B & C), and I want create a data frame using data in these list. > coffee [[1]] A B C 1 1 0.5 7.78 2 1 1.0 6.06 3 1 2.0 3.67 4 1 4.0 1.35 5 1 6.0 0.49 6 1 8.0 0.18 [[2]] A B C 1 2 5 7.78 2 2 10 6.06 3 2 20 3.67
2005 Sep 26
3
How to get the rowindices without using which?
Hi, I was wondering if it is possible to get the rowindices without using the function "which" because I don't have a restriction criteria. Here's an example of what I mean: # take 10 randomly selected instances iris[sample(1:nrow(iris), 10),] # output Sepal.Length Sepal.Width Petal.Length Petal.Width Species 76 6.6 3.0 4.4 1.4
2004 Jun 02
13
wxGrid Question
When operating with a wxGrid is there a way to get a reference to the TextCtrl field that is created when you start typing in a cell. Also is there a way to get mouse events to work with a wxGrid, so far I can''t get any of them to work. I had tried various combo''s of: @grid.evt_left_down(){ |event| puts "Left mouse is down"; } using evt_left_down, evt_left_up,