search for: icol

Displaying 20 results from an estimated 22 matches for "icol".

Did you mean: col
2017 Jul 05
4
expand gridded matrix to higher resolution
...th rep, but I am missing some magic there, since it doesn't do what we need. replicate might be promising, but then still need to rearrange the output into the column and row format we need. A simple example: mm=matrix(1:15,nrow=3,byrow = T) xmm=matrix(NA,nrow=nrow(mm)*3,ncol=ncol(mm)*3) for(icol in 1:ncol(mm)) { for(irow in 1:nrow(mm)) { xicol=(icol-1)*3 +c(1:3) xirow=(irow-1)*3 +c(1:3) xmm[xirow,xicol]=mm[irow,icol] } } mm > > mm > [,1] [,2] [,3] [,4] [,5] > [1,] 1 2 3 4 5 > [2,] 6 7 8 9 10 > [3,] 11 12 13 14 15...
2017 Jul 05
0
expand gridded matrix to higher resolution
...gic there, since it >doesn't do what we need. >replicate might be promising, but then still need to rearrange the >output into the column and row format we need. > >A simple example: >mm=matrix(1:15,nrow=3,byrow = T) >xmm=matrix(NA,nrow=nrow(mm)*3,ncol=ncol(mm)*3) >for(icol in 1:ncol(mm)) { > for(irow in 1:nrow(mm)) { > xicol=(icol-1)*3 +c(1:3) > xirow=(irow-1)*3 +c(1:3) > xmm[xirow,xicol]=mm[irow,icol] > } >} >mm >> > mm >> [,1] [,2] [,3] [,4] [,5] >> [1,] 1 2 3 4 5 >> [2,] 6 7 8...
2008 Nov 25
1
Efficient passing through big data.frame and modifying select
...e first function, f1, doesn't try to find which rows may > need adjusting > and the second, f2, does. > > f1 <- function(dframe){ > if(!is.data.frame(dframe)){ > stop("\"ResortCombinedFields\" input needs to be a data frame.") > } > for(icol in seq_len(ncol(dframe))){ > dframe[,icol] <- unlist(lapply(strsplit(dframe[,icol], > ";"), function(parts) paste(sort(parts), collapse=";"))) > } > return(dframe) > } > > f2 <- > function(dframe){ > if(!is.data.frame(dframe)){ >...
2017 Nov 22
1
assign NA to rows by test on multiple columns of a data frame
...adas at sapo.pt> A: "Massimo Bressan" <massimo.bressan at arpa.veneto.it>, "r-help" <r-help at r-project.org> Inviato: Mercoled?, 22 novembre 2017 11:49:08 Oggetto: Re: [R] assign NA to rows by test on multiple columns of a data frame Hello, Try the following. icol <- which(grepl("flag", names(mydf))) mydf[icol] <- lapply(mydf[icol], function(x){ is.na(x) <- x == 0 x }) mydf # A A_flag B B_flag #1 8 10 5 12 #2 7 NA 6 9 #3 10 1 2 NA #4 1 NA 1 5 #5 5 2 0 NA Hope this...
2009 Apr 02
1
problem with svyglm()
Hello, I'm trying to use the function svyglm in the library survey. I create a data survey object: data_svy<- svydesign(id=~PSU, strata=~sample_domain, weights=~sample_weight, data=data, nest=TRUE) and I try to use svyglm() with little success: R<-svyglm(data_svy[,4]~(data_svy[,iCol]==listModality[[iVar]] [iMod]),design=data_svy, family=binomial(link="logit") Error in svyglm.survey.design(data_svy[, 4] ~ (data_svy[, iCol] == listModality[[iVar]][iMod]), : all variables must be in design= argument Puzzlingly the following code works: R<-glm(data[,4]...
2017 Nov 22
0
assign NA to rows by test on multiple columns of a data frame
Hello, Try the following. icol <- which(grepl("flag", names(mydf))) mydf[icol] <- lapply(mydf[icol], function(x){ is.na(x) <- x == 0 x }) mydf # A A_flag B B_flag #1 8 10 5 12 #2 7 NA 6 9 #3 10 1 2 NA #4 1 NA 1 5 #5 5 2 0 NA Hope this...
2017 Jul 05
0
expand gridded matrix to higher resolution
...me magic there, since it doesn't do what we need. > replicate might be promising, but then still need to rearrange the output into the column and row format we need. > > A simple example: > mm=matrix(1:15,nrow=3,byrow = T) > xmm=matrix(NA,nrow=nrow(mm)*3,ncol=ncol(mm)*3) > for(icol in 1:ncol(mm)) { > for(irow in 1:nrow(mm)) { > xicol=(icol-1)*3 +c(1:3) > xirow=(irow-1)*3 +c(1:3) > xmm[xirow,xicol]=mm[irow,icol] > } > } > mm >> > mm >> [,1] [,2] [,3] [,4] [,5] >> [1,] 1 2 3 4 5 >> [2,] 6...
2017 Nov 22
6
assign NA to rows by test on multiple columns of a data frame
Given this data frame (a simplified, essential reproducible example) A<-c(8,7,10,1,5) A_flag<-c(10,0,1,0,2) B<-c(5,6,2,1,0) B_flag<-c(12,9,0,5,0) mydf<-data.frame(A, A_flag, B, B_flag) # this is my initial df mydf I want to get to this final situation i<-which(mydf$A_flag==0) mydf$A[i]<-NA ii<-which(mydf$B_flag==0) mydf$B[ii]<-NA
2018 Feb 25
1
reshaping column items into rows per unique ID
...ength(custs) nd <- length(dtype) df2 <- as.data.frame( matrix(rep(0,nc*(nd+1)),nrow=nc), stringsAsFactors=FALSE) colnames(df2) <- c("CustId",dtype[order(dtype)]) df2$CustId <- custs[ order(custs) ] for ( i in 1:nrow(df1) ) { iRow <- match(df1$CustId[i],df2$CustId) iCol <- match(df1$DietType[i],colnames(df2)) df2[ iRow, iCol ] <- df2[ iRow, iCol] + 1 } > df2 # CustId a b c f j # 1 1 1 1 1 0 0 # 2 2 0 0 0 0 0 # 3 3 1 0 0 0 1 # 4 4 0 0 2 1 0 The dataframe df2 will have a co...
2012 Feb 26
1
Matrix problem to extract animal associations
...E NA FALSE FALSE FALSE ID8 FALSE FALSE FALSE FALSE FALSE FALSE FALSE NA FALSE FALSE ID9 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE NA FALSE ID10 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE NA > > irow <- as.character(gl(length(IDs),length(IDs),labels=IDs)) > icol <-rep(IDs, length(IDs)) > > AssocMatrix <- matrix(data=paste(irow,"_",icol,"_",sep=""), + nrow = length(IDs), ncol = length(IDs), + dimnames= list(IDs, IDs)) > > AssocMatrix ID1 ID2 ID3...
2018 Feb 25
0
reshaping column items into rows per unique ID
I believe you need to spend time with an R tutorial or two: a data frame (presumably the "table" data structure you describe) can *not* contain "blanks" -- all columns must be the same length, which means NA's are filled in as needed. Also, 8e^5 * 7e^4 = 5.6e^10, which almost certainly will not fit into any local version of R (maybe it would in some server version --
2018 May 20
3
Loop Function to Create Multiple Scatterplots
Hello, I am trying to create multiple scatter plot graphs. I have 1 independent variable (Age - weeks post conception) and 18 dependent variables ("Gene n" Expression) in one csv file. Is there a way to set up a looped function to produce 18 individual scatterplots? At the moment, I am writing the plot() function out 18 times to make the 18 graphs. My code is below and csv file is
2018 Feb 25
4
reshaping column items into rows per unique ID
Hi All I have a datafram which looks like this : CustomerID DietType 1 a 1 c 1 b 2 f 2 a 3 j 4 c 4 c 4 f And I would like to reshape this so I can
2012 Feb 23
1
segfault when using data.table package in conjunction with foreach
...: help("data.table") data.table 1.7.10 For help type: help("data.table") *** caught segfault *** address 0x2ae93df90000, cause 'memory not mapped' Traceback: 1: .Call("dogroups", x, xcols, o__, f__, len__, jsub, SDenv, testj, byretn, byval, i, as.integer(icols), i[1, ivars, with = FALSE], if (length(ivars)) paste("i.", ivars, sep = ""), is.na(nomatch), verbose, PACKAGE = "data.table") 2: `[.data.table`(DT, , sum(sharing), by = "ID1,ID2") 3: DT[, sum(sharing), by = "ID1,ID2"] 4: computeAllPairSums(past...
2002 Jun 13
1
bad fisher.test() bug (PR#1662)
...BDR> information out of R on Linux compiled under gcc-3.1. BDR> That shows (on the original problem) BDR> Loaded symbols for BDR> /users/ripley/R/R-patched/library/ctest/libs/ctest.so BDR> #0 f3xact (nrow=0x40051074, irow=0x4005113c, BDR> ncol=0x40051000, icol=0x40051120, dlp=0x4041b110, BDR> mm=0x40050fc0, fact=0x4035f020, ico=0x4035f4dc, BDR> iro=0x4035f5a4, it=0x4035f66c, lb=0x4035f734, BDR> nr=0x4035f7fc, nt=0x4035f8c4, nu=0x4035f98c, BDR> itc=0x4035fa54, ist=0x40360094, stv=0x40364f18, BDR> alen=0x40365ba0, tol=0x4...
2005 Jun 02
3
how to configure linux in production line
I am new in linux world,basically I''m using red hat 9 kernel 2.4.20-8. I need to build a trusted gateway. my linux box will be the gateway for several machine PCs to go to the desired server. there will be several subnets under the linux box, I''ve already assigned static IPs for the PCs . Now my problem is I only need 2 PCs from each subnets to connect to certain servers, and
2009 Mar 09
5
Help
...does. > > >>> > > >>> f1 <- function(dframe){ > > >>> if(!is.data.frame(dframe)){ > > >>> stop("\"ResortCombinedFields\" input needs to be a data frame.") > > >>> } > > >>> for(icol in seq_len(ncol(dframe))){ > > >>> dframe[,icol] <- unlist(lapply(strsplit(dframe[,icol], > > >>> ";"), function(parts) paste(sort(parts), collapse=";"))) > > >>> } > > >>> return(dframe) > > >>&g...
2010 Jul 27
1
R CMD build wiped my computer
.../local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_inv.c -o cs_inv.o cs_inv.c: In function ?cs_inv?: cs_inv.c:9: warning: ?irow? may be used uninitialized in this function cs_inv.c:9: warning: ?icol? may be used uninitialized in this function gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_invR.c -o cs_invR.o cs_invR.c: In function ?cs_invR?:...
2010 Jul 27
1
R CMD build wiped my computer
.../local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_inv.c -o cs_inv.o cs_inv.c: In function ?cs_inv?: cs_inv.c:9: warning: ?irow? may be used uninitialized in this function cs_inv.c:9: warning: ?icol? may be used uninitialized in this function gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_invR.c -o cs_invR.o cs_invR.c: In function ?cs_invR?:...
2010 Jul 27
1
R CMD build wiped my computer
...-I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_inv.c -o cs_inv.o cs_inv.c: In function ?cs_inv?: cs_inv.c:9: warning: ?irow? may be used uninitialized in this function cs_inv.c:9: warning: ?icol? may be used uninitialized in this function gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_invR.c -o cs_invR.o cs_invR.c: In function ?cs_invR?: cs_invR...