search for: col4

Displaying 20 results from an estimated 81 matches for "col4".

Did you mean: col
2006 Mar 16
3
Did I use "step" function correctly? (Is R's step() function reliable?)
Hi all, I put up an exhaustive model to use R's "step" function: ------------------------ mygam=gam(col1 ~ 1 + col2 + col3 + col4 + col2 ^ 2 + col3 ^ 2 + col4 ^ 2 + col2 ^ 3 + col3 ^ 3 + col4 ^ 3 + s(col2, 1) + s(col3, 1) + s(col4, 1) + s(col2, 2) + s(col3, 2) + s(col4, 2) + s(col2, 3) + s(col3, 3) + s(col4, 3) + s(col2, 4) + s(col3, 4) + s(col4, 4) + s(col2, 5) + s(col3, 5) + s(col4, 5) + s(col2, 6) + s(col3, 6) + s(col4, 6)...
2004 Jul 05
2
More difficulties in getting data into R
In order to get around the problems of my posting a few minutes ago, I thought: $ awk -F\| '(NR > 2) {print $2}' cmie_firm_data.text > col2 $ awk -F\| '(NR > 2) {print $4}' cmie_firm_data.text > col4 $ paste col2 col4 | head -2 -510.45 -510.27 60700 101900 $ paste col2 col4 | tail -2 28648.12 31617.02 491014.77 494308.52 $ wc -l col2 col4 89323 col2 89323 col4 178646 total So all is well. But R doesn't like it: $ R --vanilla < picture.R R : Copyright 2004, The R...
2017 Jun 21
4
selecting dataframe columns based on substring of col name(s)
Suppose I have the following sort of dataframe, where each column name has a common structure: prefix, followed by a number (for this example, col1, col2, col3 and col4): d = data.frame( col1=runif(10), col2=runif(10), col3=runif(10),col4=runif(10)) What I haven't been able to suss out is how to efficiently 'extract/manipulate/play with' columns from the data frame, making use of this common structure. Suppose, for example, I want to 'work...
2010 Jul 24
2
union data in column
Is there any function/way to merge/unite the following data GENEID col1 col2 col3 col4 G234064 1 0 0 0 G234064 1 0 0 0 G234064 1 0 0 0 G234064 0 1 0 0 G2340...
2009 Oct 02
3
help with regexp mass substitution
...ello * i have to rename a lot of variables, and, given that they have regular name constructs, I would like to use regexps. Here's a dump of my head(names(df)) varnames <- c("id.quest", "txt.1.3", "col1.1.3", "col2.1.3", "col3.1.3", "col4.1.3", "col5.1.3", "txt.2.3", "col1.2.3", "col2.2.3", "col3.2.3", "col4.2.3", "col5.2.3", "txt.3.3", "col1.3.3", "col2.3.3", "col3.3.3", "col4.3.3", "col5.3.3", &q...
2017 Jun 21
0
selecting dataframe columns based on substring of col name(s)
> On Jun 21, 2017, at 9:11 AM, Evan Cooch <evan.cooch at gmail.com> wrote: > > Suppose I have the following sort of dataframe, where each column name has a common structure: prefix, followed by a number (for this example, col1, col2, col3 and col4): > > d = data.frame( col1=runif(10), col2=runif(10), col3=runif(10),col4=runif(10)) > > What I haven't been able to suss out is how to efficiently 'extract/manipulate/play with' columns from the data frame, making use of this common structure. > > Suppose, for exam...
2009 Oct 22
2
How to find moving averages within each subgroup of a data frame
Dear all, If I have the following data frame: > set.seed(21) > df1 <- data.frame(col1=c(rep('a',5), rep('b',5), rep('c',5)), col4=rnorm(1:15)) col1 col4 1 a 0.793013171 2 a 0.522251264 3 a 1.746222241 4 a -1.271336123 5 a 2.197389533 6 b 0.433130777 7 b -1.570199630 8 b -0.934905667 9 b 0.063493345 10 b -0.002393336 11 c -2.276781240 12 c 0.757412225 13 c -0.5...
2010 Mar 22
1
help needed with boxplot
I am new to R, can anyone help with boxplot for a dataset like: file1 col1 col2 col3 col4 col5 050350005 101 56.625 48.318 RED 051010002 106 50.625 46.990 GREEN 051190007 25 65.875 74.545 BLUE 051191002 246 52.875 57.070 RED 220050004 55 70 80.274 BLUE 220150008 75 67.750 62.749 RED 220170001 77 65.750 54.307 GREEN file2 col1 col2 col3 col4 col5 050350005 101 56.625 57 RED 051010002 106...
2019 Feb 12
7
Leer un txt a trozos
Estimad en s eRRer en s, Tengo un txt que quiero importar a R. Pero no tiene un formato adecuado para usar cosas normales, como por ejemplo read.csv() El formato es algo así: time 1 col1 col2 col3 col4 dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato end time 2 col1 col2 col3 col4 dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato dato end time 3 col1 col2 col3 col4 dato dato dato dato dato dato dato...
2010 Oct 11
2
Split rows depending on time frame
Hi, I have the following data frame, where col2 is a startdate and col3 an enddate COL1 COL2 COL3 A 40462 40482 B 40462 40478 The above timeframe of 3 weeks I would like to splits it in weeks like this COL1 COL2 COL3 COL4 A 40462 40468 1 A 40469 40475 1 A 40476 40482 1 B 40462 40468 1 B 40469 40475 1 B 40476 40478 0.428 Where COL4 is an identifier if the timeframe between COL2 and COL3 is exactly 7 d...
2008 Mar 16
2
How to loop through all the columns in dataframe
...I need to include while looping: varA<- 0.0000036084 covAB<- (-0.0000013046) varB<- 0.00000052628 After transposing my dataframe I need something like the following: varA + col1*covAB + col2*covAB + col1*col2*varB varA + col1*covAB + col3*covAB + col1*col3*varB varA + col1*covAB + col4*covAB + col1*col4*varB varA + col1*covAB + col5*covAB + col1*col5*varB and so on.. then do it all over again but starting with col2 varA + col2*covAB + col3*covAB + col2*col3*varB varA + col2*covAB + col4*covAB + col2*col4*varB varA + col2*covAB + col5*covAB + col2*col5*varB t...
2013 Feb 16
8
Unir varias columnas en una sola
Buenas a todos, relato directamente mi problema. Estoy preparando unos datos para ingresarlos en otro programa que requiere una columna de ID y el resto de la información toda seguida sin espacios. El echo es que yo tengo la información separada en columnas, por ejemplo: ID col2 col3 col4 col5 etc. y precisaría dejarla de la siguiente forma: ID col2col3col4col5 etc. Para luego escribir a disco y proceder con otro software. Alguien sabe que comando puedo usar para juntar una serie columnas todas en un bloque solo? Saludos y muchas gracias de ante mano!! Fernando Macedo
2012 Oct 18
4
speeding read.table
...Colleagues, I am reading a 1 GB file into R using read.table. The file consists of 100 tables, each of which is headed by two lines of characters. The first of these lines is: TABLE NO. 1 The second is a list of column headers. For example: TABLE NO. 1 COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 COL9 COL10 COL11 COL12 1.0010E+05 0.0000E+00 1.0000E+00 1.0000E+03 -1.0000E+00 1.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 1.0010E+05 1.0001E+01 1.0000E+00 1.0000E+03 -1.0000E...
2010 Apr 29
2
by funtion
Hello, I have a data.frame: name    col1    col2    col3    col4 AA    23    54    0.999    0.78 BB    123    5    1    0.99 AA    203    98    0.79    0.99 I want to get mean value data.frame in terms of name: name    col1    col2    col3    col4 AA    113.0000  76.0000   0.8945   0.8850 BB    123.00   5.00   1.00   0.99 I tried to use by function: >aa...
2010 Sep 27
1
compare two matrices
Hi everyone: I have a kinda easy question but i do not know how to solve that in a simple way. I want to compare the rows of two matrices. col1 <- c(1,2,3,4,5,6) col2 <- c(6,5,4,3,2,1) m <- cbind(col1, col2) col3 <- c(1,3,2,6) col4 <- c(6,3,5,1) n <- cbind(col3, col4) In matrix n, for example the first row is (1,6), it is also some row in matrix m, i want the code results "TRUE". then for the 2nd row (3,3), it should be FALSE. So in this case it should be (TRUE, FALSE, TRUE, TRUE) I tried...
2009 Dec 20
2
Remove rows in a matrix that match rows in another matrix
...e matrix that match rows in another large matrix. A (small scale) example: col1<-c("A", "B", "C", "D") col2<-c("A", "B", "C", "D") m1<-cbind(col1, col2) col3<-c("B", "C", "D") col4<-c("B", "C", "z") m2<-cbind(col3, col4) Any ideas on how to get the following matrix? [,1] [,2] [1,] "A" "A" [2,] "D" "D" Thanks very much in advance, Ray [[alternative HTML version deleted]]
2006 Dec 14
5
Better way to change the name of a column in a dataframe?
Hello R users -- If I have a dataframe such as the following, named "frame" with the columns intended to be named col1 through col6, > frame col1 col2 cmlo3 col4 col5 col6 [1,] 3 10 2 6 5 7 [2,] 6 8 4 10 7 1 [3,] 7 5 1 3 1 8 [4,] 10 6 5 4 9 2 and I want to correct or otherwise change the name of one of the columns, I can do so with > dimnames(frame)[[2]][which(dimnames(...
2013 Jan 03
5
splitting matrices
Dear useRs, i want to split a matrix having 1116rows and 12 columns. i want to split that matrix into 36 small matrices each having 12 columns and 31 rows. The big matrix should be splitted row wise. which means that the first small matrix should copy values which are in first 31 rows and 12 columns of the big matrix. similarly 2nd small matrix should contain values from 32nd to 63rd row of the
2008 Apr 09
1
Replace values according to conditions
Greetings R-users, I have the following data called mydata in a data.frame Col1 Col2 Col3 Col4 Col5 1 2 4 6 7 8 8 7 3 5 4 4 5 6 7 I want to replace the data according to the following conditions Condition 1 if data <= 3, replace with -1 Condition 2 if data >=6, replace with 1 Condition 3 if data = 4 or data =5, replace with...
2010 Oct 21
2
Adding rows to column
...quot;;", header=F, na.strings=NA, fill=T) #extracting column 7 where rows match "ID" col1<- table2[grep("ID", table2[,1]),7] #similarly extracting column 9,11,13,15 col2<- table2[grep("ID", table2[,1]),9] col3<- table2[grep("ID", table2[,1]),11] col4<- table2[grep("ID", table2[,1]),13] col5<- table2[grep("ID", table2[,1]),15] there are also some other single columns I extracted from other file. Now I want to combine all these single columns into a single table with corresponding headers. Any hint on how that can be do...