similar to: Arrange elements on a matrix according to rowSums + short 'apply' Q

Displaying 20 results from an estimated 3000 matches similar to: "Arrange elements on a matrix according to rowSums + short 'apply' Q"

2006 Jul 06
3
Comparing two matrices
hi: I have matrix with dimensions(200 X 20,000). I have another file, a tab-delim file where first column variables are row names and second column variables are column names. For instance: > tmat Apple Orange Mango Grape Star A 0 0 0 0 0 O 0 0 0 0 0 M 0 0 0 0 0 G 0 0 0 0 0 S 0 0 0 0 0
2006 Jul 06
3
Comparing two matrices [Broadcast]
It might be a bit faster to do matrix indexing: R> tbm <- as.matrix(tb) # turn it into a character matrix R> tmat[cbind(match(tbm[,2], rownames(tmat)), match(tbm[,1], colnames(tmat)))] <- 1 > tmat Apple Orange Mango Grape Star A 1 1 1 0 0 O 1 1 0 0 0 M 0 0 1 0 0 G 0 0 0 0 0 S 1 1 1 0
2000 Apr 05
2
My first R-program
Sorry, I pasted the wrong file in earlier... this is the correct one: pValCalculator(b, n=20, m=20) { ind <- 1:min(c(n,m)) prob <- (1-pnorm(b,sd=std*sqrt(ind))) prob1 <- sum((n-ind+1)*(m-ind+1)*prob) prob1 } inputData <- scan("/users/lvssso/projects/LAMA/output/pValLamaScore.tmp", list(block1 = "",block2 = "",width1 = 0,width2 = 0,alignment = 0,score
2002 Mar 18
2
persp(): add second plane (second, long question)
Thank you for your replies so far. Sorry for bothering you again, but I'm still not able to get what I need as I don't understand all parts of the replies (just using R for easy things....). Is there a code for plane3d() like some of you sent me for points3d()? I was not able to get that out of the scatterplot3d package... What I can do is to get the x,y and z-range for the xlim,ylim and
2006 Mar 25
2
pairwise combinatons of variables
Dear WizaRds, although this might be a trivial question to the community, I was unable to find anything solving my problem in the help files on CRAN. Please help. Suppose I have 4 variables and want to use all possible combinations: 1,2 1,3 1,4 2,3 2,4 3,4 for a further kmeans partitioning. I tried permutations() of package e1071, but this is not what I need. Thank you for your help and
2005 Sep 09
2
Question about plotting discontinuous data
Hi, I have a simple question that I just cannot figure out. I have 2 corresponding columns of data, one column (X-axis) for time (formatted thus: 8:30:01am = 830.1, 12:30:05pm = 1230.5, and one column (Y-axis) for values. When I attempt to plot the data using something like plot(inputdata[,1],inputdata[,2],type="l"); I get breaks in the plot (since the time essentially jumps from
2009 Oct 14
2
attach
Hi all, I have a question regarding the memory usage for the attach function. Say I have a data.frame inputdat that I create with read.csv. I would like to know what happens on the memory side when I use attach(inputdata) Is there a second allocation of memory for inputdata? Then I'm using eval on a expression which depends on the columns of inputdata. Is it better not to use attach
2005 Apr 08
2
DLL Memory Problem
Hello, I have created a .dll file using G77 and MinGW on my PC (Windows 2000). After using dyn.load to bring it into R2.0.1, I then call the .dll through the function ccprox shown below. It returns the correct values. If I run it a second time though it returns different values, so it seems something is being placed oddly in memory. If I unload and reload the .dll it works again the first
2003 Feb 21
5
Problem Writeing a pipe using R (stdin is consumed)
Hi everybody, I a, trying to use R as a pipe like this: cat inputData | R --silent RCommandFile >outputData The RCommandFile would contain something like readLines(stdin()). I have tryed various things and none did work cleanly. One possible solution is to use the pipe() function inside R and to pass in the "cat inputData" however this is not very convenient since I would like to
2018 Apr 12
2
R Timeseries tsoutliers:tso
Hello, Writing to seek help in regard to some unexpected performance anomaly i am observing in using tsoutlers:tso on the mac vs on an AWS cloud server.. I am running the following code with very small dataset of about 208 records. d.dir <- '/Users/darshanpandya/xxxxxx' FNAME <- 'my_data.csv' d.input <- fread(file.path(paste0(d.dir,"/zzz/"),FNAME,fsep =
2013 May 17
1
[LLVMdev] Alignment attribute of function arguments
Hello everyone, Hopefully a simple question. How can I access function argument alignment information? If my code has something like this: void foo(short * __restrict __attribute__ ((aligned(8))) InputData){} ...as I deal with argument (InputData) can I get the alignment info set for it? Thanks! Sergei --- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
2000 Aug 29
4
short way
i want to replace certain values of a matrix. i know how to replace them when the values are in a vector. i tried the same way for a matrix and got this answer: la[la==0]<-1 Error in [<-.data.frame(*tmp*, la == 0, value = 1) : matrix subscripts not allowed in replacement i found a way to do this with "for()", but i think this is the worst way to do it. So is there a
2010 Oct 07
1
model.frame deficiency
The model.frame function has trouble with a certain type of really long formula. Here is a test: tname <- paste('var', 1:50, sep='') tmat <- matrix(rnorm(500), ncol=50, dimnames=list(NULL, tname)) tdata <- data.frame(tmat) temp1 <- paste( paste(tname, tname, sep='='), collapse=', ') temp2 <- paste("~1 + cbind(", temp1, ")")
2011 Jan 17
2
Difficult with round() function
Dear list, I'm writing a function to re-grid a data set from finer to coarser resolutions in R as follows (I use this function with sapply/apply): gridResize <- function(startVec = stop("What's your input vector"), to = stop("Missing 'to': How long do you want the fnial vector to be?")){ from <- length(startVec) shortVec<-numeric() tics <- from*to
2018 Apr 13
0
Fwd: R Timeseries tsoutliers:tso
Hello, Writing to seek help in regard to some unexpected performance anomaly i am observing in using tsoutlers:tso on the mac vs on an AWS cloud server.. I am running the following code with very small dataset of about 208 records. d.dir <- '/Users/darshanpandya/xxxxxx' FNAME <- 'my_data.csv' d.input <- fread(file.path(paste0(d.dir,"/zzz/"),FNAME,fsep =
2009 Nov 19
1
problem post request with RCurl
Hi, I am trying to use a CGI service (Pubchem PUG) via RCurl and am running into a problem where the data must be supplied via POST - but I don't know the keyword for the argument. The data to be sent is an XML fragment. I can do this via the command line using curl: I save the XML string to a file called query.xml and then do curl -d @query.xml
2003 Oct 31
2
Summing elements in a list
Hi, Suppose that I have a list where each component is a list of two matrices. I also have a vector of weights. How can I collapse my list of lists into a single list of two matrices where each matrix in the result is the weighted sum of the corresponding matrices. I could use a loop but this is a nested calculation so I was hoping there is a more efficient way to do this. To help clarify,
2017 Jun 04
0
New var
Since the number of choices is small (6), how about this? Starting with Jeff's initial DFM: DFM <- structure(list(obs = 1:6, start = structure(c(16467, 14710, 13152, 13787, 15126, 12696), class = "Date"), end = structure(c(17167, 14975, 13636, 13879, 15340, 12753), class = "Date"), D = c(700, 265, 484, 92, 214, 57), bin = structure(c(6L, 3L, 5L, 1L, 3L, 1L), .Label
2001 Jul 17
2
cmdscale in package mva (PR#1027)
Full_Name: Laurent Gautier Version: 1.3.0-patched OS: IRIX 6.5 Submission from: (NULL) (130.225.67.199) Hello, The function La.eigen, called by cmdscale in the package mva behaves an unexplicable way (for me). The following lines show what happened. I tried the very same on linux, and it worked fine. >a <- matrix(c(1,2,3,2),3,3) >a [,1] [,2] [,3] [1,] 1 2 3 [2,]
2011 Mar 11
1
Easy 'apply' question
Dear list, I couldn't find a solution for this problem online, as simple as it seems. Here's the problem: #Construct test dataframe tf <- data.frame(1:3,4:6,c("A","A","A")) #Try the apply function I'm trying to use test <- apply(tf,2,function(x) if(is.numeric(x)) mean(x) else unique(x)[1]) #Look at the output--all columns treated as character