search for: colb

Displaying 20 results from an estimated 27 matches for "colb".

Did you mean: col
2008 Jun 27
2
change values in data frames
Hello every body, I am quite a new user of R so I beg your pardon for this naive question and the lake of syntax with wich I ask it: I have a data frames like this: cola colb 1 c 1 i 1 i 1 c 2 i 2 c 2 c 2 i 2 i ... 10000 I would like ,for each level of cola and for x in colb: -if colb[x]=="i" and colb[x-1] does not exist (first row in dataframes), then replace colb[x] by "l" -if colb[x]=="i" and colb[x-1]=="c" (previous row in d...
2012 Oct 04
4
Subsetting a group of data
...I am making my way down the learning curve of R, and find it a great language with so many helpful users! Below is an example of what I'm trying to do, but can't quite figure out the right path to go down. Here's what I have: Main is a time series of data with columns Cola and Colb Cola Colb 1 1 1 2 1 1 3 1 1 4 -1 1 5 -1 -1 6 -1 -1 7 1 -1 8 -1 -1 9...
2005 Sep 09
3
how to do something like " subset(mat, ("col1">4 & "col2">4)) "
Dear all, I have a problem with the "subset()" function. I spent all day yesterday with a collegue to solve it and we did not find a satisfying solution (even in the archived mails), so I ask for your help. Let's say (for a simple example) a matrix mat: R> mat cola colb colc [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 My goal is to select the lines of the matrix on the basis of the values of more than one column (let's say colb and colc). For example I want to select all the lines of the matrix for which values in colb and colc are more than 4. I tried several ways...
2006 Apr 12
0
New class: data.table
...yet implemented) Motivation: * up to 10 times less memory * up to 10 times faster to create, and copy * simpler R code * the white book defines rownames, so data.frame can't be changed ... => new class Examples: nr = 1000000 D = rep(1:5,nr/5) system.time(DF <<- data.frame(colA=D, colB=D)) # 2.08 system.time(DT <<- data.table(colA=D, colB=D)) # 0.15 (over 10 times faster to create) identical(as.data.table(DF), DT) identical(dim(DT),dim(DF)) object.size(DF)/object.size(DT) # 10 times less memory tt = subset(DF,colA>3) ss = DT[colA>3] identical(as.d...
2009 Jul 12
2
Nonlinear Least Squares nls() programming help
...Solver does. I'm new to nonlinear optimization, so please forgive any obvious things I've overlooked. Thank you very much for taking a look! Here is the R code, and error message: ColumnA.data<-read.csv(file.choose()) #select ColA.csv ColumnB.data<-read.csv(file.choose()) #select ColB.csv ColumnC.data<-read.csv(file.choose()) #select ColC.csv colA<-ColumnA.data[0:3600,] colB<-ColumnB.data[0:3600,] colC<-ColumnC.data[0:3600,] i<-1:3600 cor.model<-nls(colC ~ exp( - beta2 * abs( colB[i] - colA[i] ) / 12 ) - ( 1 - exp( - beta2 * abs( colB[i] - colA[i] ) / 12 ) )...
2012 Jul 11
4
Help with loop
Hi, I have two dataframes: The first, df1, contains some missing data: cola colb colc cold cole 1 NA 5 9 NA 17 2 NA 6 NA 14 NA 3 3 NA 11 15 19 4 4 8 12 NA 20 The second, df2, contains the following: cola colb colc cold cole 1 1.4 0.8 0.02 1.6 0.6 I'm wanting all missing data in df1$cola to be replaced by the value...
2011 Aug 03
2
Error message for MCC
...iles_to_test <- list.files(pattern = "combine.kegg") > > ########################## > ## Initialize Variables ## > vl <- length(files_to_test) > temp <- vector(mode="numeric", length = vl) > colA <- vector(mode="numeric", length = vl) > colB <- vector(mode="numeric", length = vl) > tt <- vector(mode="numeric", length = vl) > > > ######################## > ## Calculate P-values ## > for (i in 1:3){ + temp1 <- read.table(files_to_test[i], header=TRUE, sep=" ") + numrows <-...
2013 Apr 30
2
R Function to extract columnNames
Hi, May be this helps: funcName<- function(df1, x){ ?whatCol=df1[[x]] ?print("Got it") ?print(whatCol) ?} ? funcName(df,"ColA") #[1] "Got it" #[1] 1 2 3 4 5 ? funcName(df,"ColB") #[1] "Got it" #[1] A B C D E #Levels: A B C D E A.K. >I am trying to extract the 2nd column from a dataframe using a function called funcName. Note this is an example that I need cos I am using it to >read the values I pass into a function call - these passed values re...
2011 Aug 05
2
Which is more efficient?
Greetings all, I am curious to know if either of these two sets of code is more efficient? Example1: ## t-test ## colA <- temp [ , j ] colB <- temp [ , k ] ttr <- t.test ( colA, colB, var.equal=TRUE) tt_pvalue [ i ] <- ttr$p.value or Example2: tt_pvalue [ i ] <- t.test ( temp[ , j ], temp[ , k ], var.equal=TRUE) ------------- I have three loops, i, j, k. One to test the all of <i> files in a directory. One to tease...
2011 Jun 10
2
Sorting Data Frame Without Loop
...ing so far. I have only managed to get this to work by using a loop, which I know is not the best way, but at the moment I'm stuck. colA <- c("M-012847-00" ,"M-012847-00" ,"M-015544-00", "M-015544-00", "M-024202-00","M-024202-00") colB <- c("NM_057175", "NM_057175", "NM_153008", "NM_153027", "NM_207330", "NM_207330") colC <- c( 'NARG1', 'TBDN100', 'FLJ30277', 'FLJ31659', 'NIPAL1', 'NPAL1') dupes <- data.frame(Pro...
2010 Dec 09
2
Reshape Columns
Hello, I have a general formatting question. I have two columns of data: ColA <- c("m", "m", "m", "m") ColB<- c("d","d","d","d") And I would like to reorder them into a new column that looks like this: ColC<- c("m","d","m","d","m","d","m","d") Thank you! Stephanie ___________...
2010 Feb 10
2
sum sections of data of different lengths from within a data frame
Dear R Help: I am trying to sum data from one column in a dataframe based on a value in another. I do not know how to do this easily in R. For example: Col A Col B 1 0 3 0 2 1 2 0 1 0 4 0 1 1 9 1 3 0 5 0 2 1 I would like to cumsum the values in Col A for all rows where Col B is 0, and a value of 1 in Col B will reset
2013 Apr 03
2
Creating data frame from individual files
Dear Group: I have 72 files (.txt). Each file has 2 columns and column 1 is always identical for all 70 files. Each file has 90,799 rows and is standard across all files. I want to create a matrix 40(rows) x 70 columns. I tried : temp = list.files(pattern="*.txt") named.list <- lapply(temp, read.delim) library(data.table) files.matrix <-rbindlist(named.list) >
2013 May 26
0
SAPPLY function for COLUMN NULL
colnames(dd) #[1] "col1" "colb" null_vector<- colnames(dd) sapply(null_vector,makeNull,dd) #???? col1 colb #[1,]?? NA??? 4 #[2,]??? 2?? NA #[3,]??? 3??? 2 #[4,]??? 4?? NA #[5,]??? 1??? 4 #[6,]?? NA??? 5 #[7,]??? 1??? 6 A.K. >I am trying to make a column value in a dataframe = NA if there is a 0 or high value in tha...
2011 Jul 19
4
Samba Share Access denied on Solaris
Hi I have reinstalled the Solaris 10 server with update 9 and now runs samba 3.5.5. I can log into the share but cannot open it. It says permissions denied . I modified the permissions on OS but still face the same error. Any kind of help will be appreciated. Kind Regards Dee DISCLAIMER: This message and any attachments are confidential and intended solely for the addressee. If
2012 Jul 11
1
sapply question
Why does this sapply code change df3 but not df1? Thanks df1 <- read.table(text=" cola colb colc cold cole 1 NA 5 9 NA 17 2 NA 6 NA 14 NA 3 3 NA 11 15 19 4 4 8 12 NA 20 ", header=TRUE) df2 <-df1*2 df1 df2 df3 <-sapply(names(df1),function(x) {df1[[x]]<- df2[[x]]}) df1 df3 [[alternative HTML version deleted]]
2005 Aug 22
3
read a table ignoring specific rows ?
Dear R users, First of all sorry for this question, surely quite naive. (I searched on the R site but was unable to find by myself). I have a table, called infile : 1 2 3 4 5 6 7 8 9 I would like to read it and ignore the rows with 1st element > 3 I do it now with a for loop, and it's ok, but I was expecting something simpler, like : intable = read.table(infile); newtable =
2011 May 28
1
newbie xml parsing question
...-aftertext\"> <li> \"/mortgage-rates/#{scid=mor-site-mapbubrates}\" See rates </li></ul> </li> </ul> <ul class=\"attributes\"> <li class=\"prop-cola\">Beds: 3<br /> Baths: 1.0</li> <li class=\"prop-colb\">Sqft: 1,630<br /> Lot: 21,745</li> </ul> </div> <ul class=\"has-photo actions clearfix\"> <li class=\"hinfo ztsa\"> \"/homedetails/236-Arundel-Ave-Horsham-PA-19044/9933810_zpid/#{scid=hdp-site-map-bubble-details}\" Details...
2010 Nov 05
1
How to extract particular rows and column from a table
Hello, I'm a new user of R. I've a very big table like the following structure (suppose the variable name with "aa"). From this table I want to make a new table which'll contain just two column with V2 and V6 with some particular rows( Suppose, variable name with "bb"). I'd like to mention V2 column is representing the id that correspond to the column V6 whis
2015 Feb 24
2
intercalar elementos de vectores
...cómo procesar toda la > tabla que tienes: > > > #Creo un data.frame de ejemplo todo con letras > > vtmp <- as.data.frame(lapply(letters,function(x) { rep(x,each=50) })) > > names(vtmp) <- paste("col",LETTERS,sep="") > > head(vtmp) > colA colB colC colD colE colF colG colH colI colJ colK colL colM colN > colO colP colQ colR colS colT colU colV colW colX colY colZ > 1 a b c d e f g h i j k l m n > o p q r s t u v w x y z > 2 a b c d e...