similar to: remove and put back elements in vector

Displaying 20 results from an estimated 10000 matches similar to: "remove and put back elements in vector"

2013 Apr 24
2
Distance matrices Combinations
Dear UseRs, MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation. t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T)) Then "1215450" values of "t"(one for
2013 Oct 11
3
matrix values linked to vector index
Hi, In the example you showed: m1<- matrix(0,length(vec),max(vec)) 1*!upper.tri(m1) #or ?m1[!upper.tri(m1)] <-? rep(rep(1,length(vec)),vec) #But, in a case like below, perhaps: vec1<- c(3,4,5) ?m2<- matrix(0,length(vec1),max(vec1)) ?indx <- cbind(rep(seq_along(vec1),vec1),unlist(tapply(vec1,list(vec1),FUN=seq),use.names=FALSE)) m2[indx]<- 1 ?m2 #???? [,1] [,2] [,3] [,4] [,5]
2013 Apr 25
2
connecting matrices
Dear Elisa, Try this: el<- matrix(1:100,ncol=20) ?set.seed(25) ?el1<- matrix(sample(1:100,20,replace=TRUE),ncol=1) In the example you showed, there were no column names.? ?list(el[,sort(el1)[1:3]],sort(el1,index.return=TRUE)$ix[1:3]) #[[1]] ?# ?? [,1] [,2] [,3] #[1,]?? 31?? 61?? 71 #[2,]?? 32?? 62?? 72 #[3,]?? 33?? 63?? 73 #[4,]?? 34?? 64?? 74 #[5,]?? 35?? 65?? 75 # #[[2]] #[1] 9 5 3 A.K.
2003 Jun 06
4
sas vs. r
I like R more than SAS. My job is doing research on clinical trial. But I was told that FDA only accepts the result from SAS. Is that true? TOO BAD. [[alternate HTML version deleted]]
2003 Jun 13
2
maps library for R?
Hi there, Does it already exist a library in R to draw maps (something like a Generic Mapping Toolbox, http://gmt.soest.hawaii.edu/ port). I've seen in an old R-help that Ross Ihaka once tried to port the S-plus map library (http://maths.newcastle.edu.au/~rking/R/help/99b/0832.html ). Anybody know if this package is available somewhere or if there is somebody developing a Mapping package
2003 Sep 22
2
documentation search: problem with links (PR#4254)
Full_Name: Kevin S. Van Horn Version: 1.7.1 OS: Linux Submission from: (NULL) (12.209.149.192) I used help.start() to get the web help displayed in my browser (Mozilla 1.21, on a RedHat Linux 9.0 system). I then clicked on "Search Engine and Keywords", and searched on "optimize". The resulting web page had a number of links. The first time I clicked on one these links it
2011 Apr 06
5
Need a more efficient way to implement this type of logic in R
I have cobbled together the following logic. It works but is very slow. I'm sure that there must be a better r-specific way to implement this kind of thing, but have been unable to find/understand one. Any help would be appreciated. hh.sub <- households[c("HOUSEID","HHFAMINC")] for (indx in 1:length(hh.sub$HOUSEID)) { if ((hh.sub$HHFAMINC[indx] == '01')
2013 Apr 06
5
arrange data
Hello all! I have a problem to arrange data in another form. My initial data is like this: 'data.frame': 421 obs. of 58 variables: $ 01A: num NA NA NA NA NA NA NA NA NA NA ... $ 01B: num NA NA NA NA NA NA NA NA NA NA ... $ 03A: num NA NA NA NA NA NA NA NA NA NA ... $ 03B: num NA NA NA NA NA NA NA NA NA NA ... $ 05A: num NA NA NA NA NA NA NA NA NA NA ... $ 05B: num NA NA NA NA
2003 May 08
1
nls, restrict parameter values
Hi, I posted a question (bellow) a few weeks ago and had a reply (thanks Christian) that partly solves the problem, but I still would like to be able to restrict some of the independent variables in a nls model to be always >0, (is there a way to do it)?? Thanks, Angel >From: "Christian Ritz" <ritz at dina.kvl.dk> >To: "Angel -" <angel_lul at
2004 Sep 15
7
Splitting vector into individual elements
Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a predefined function call? offred.rgb <- c(1, 0, 0) * 0.60; ## Brute force style offred.col <- rgb(offred.rgb[1], offred.rgb[2], offred.rgb[3], names = "offred") ## Desired style
2013 Apr 07
2
group data in classes
Hello all! I have a problem to group my data (years) in 10 years classes. For example for year year decade 1598 1590-1600 1599 1590-1600 1600 1590-1600 1601 1600-1610 --- my is like this> [1] 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 [16] 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 [31] 1628 1629 1630 1631 1632 1633
2013 Mar 22
3
Distance calculation
Hi Elisa, I hope this is what you wanted. dat1<-read.csv("peaks.csv",sep=",") #Subset dat2<-dat1[1:5,] res1<-do.call(cbind,lapply(seq_len(nrow(dat2)),function(i) do.call(rbind,lapply(split(rbind(dat2[i,],dat2[-i,]),1:nrow(rbind(dat2[i,],dat2[-i,]))), function(x) {x1<-rbind(dat2[i,],x);
2012 Mar 16
3
Faster way to implement this search?
I am working on a simulation where I need to count the number of matches for an arbitrary pattern in a large sequence of binomial factors. My current code is for(indx in 1:(length(bin.05)-3)) if ((bin.05[indx] == test.pattern[1]) && (bin.05[indx+1] == test.pattern[2]) && (bin.05[indx+2] == test.pattern[3])) return.values$count.match.pattern[1] =
2012 Feb 21
2
Dataframes in PLS package
I have been working with the pls procedure and have problems getting the procedure to work with matrix or frame data. I suspect the problem lies in my understanding of frames, but can't find anything in the documentation that will help. Here is what I have done: I read in an 10000 x 8 table of data, and assign the first four columns to matrix A and the second four to matrix B pls <-
2006 May 14
1
Dragable element
Hey all Im having a problem... Ok, this is the situation... I have a small product image, on which ive floated a div over it, and defined it as draggable. Now, this works, and i can drag it around no problem. great. but then, what i want to do is, based on the location of that dragable element from the top and the left, to move (using the Effect.MoveBy method) a larger image - so effective
2006 May 26
2
combinatorial programming problem
Hola! I am programming a class (S3) "symarray" for storing the results of functions symmetric in its k arguments. Intended use is for association indices for more than two variables, for instance coresistivity against antibiotics. There is one programming problem I haven't solved, making an inverse of the index function indx() --- se code below. It could for instance return the
2003 Apr 14
2
compile error RH9 & R162
Hi, I tried to compile source because for RH9.0 doesn't exist binary. During compiling I got error: *********************** make[3]: Entering directory `/home/allans/R-1.6.2/src/library/methods' dumping R code in package 'methods' Error in eval(expr, envir, enclos) : couldn't find function "character" Execution halted make[3]: *** [../../../library/methods/R/all.rda]
2003 Oct 29
1
Wishlist: user-specified color names for palette() (PR#4836)
Full_Name: Hsiu-Khuern Tang Version: 1.8.0 OS: GNU/Linux (Debian unstable) Submission from: (NULL) (156.153.255.243) Hi, I use palette(rgb(red=..., green=..., blue=..., names=mycolors)) to define my own color palette. After doing this, the names `mycolors' are not stored in palette() anymore, so that palette() returns a mix of built-in color names and RGB values. Eg: > palette()
2014 Mar 24
4
[PATCH 1/4] pm/fan: drop the fan lock in fan_update() before rescheduling
From: Martin Peres <martin.peres at labri.fr> This should fix a deadlock that has been reported to us where fan_update() would hold the fan lock and try to grab the alarm_program_lock to reschedule an update. On an other CPU, the alarm_program_lock would have been taken before calling fan_update(), leading to a deadlock. We should Cc: <stable at vger.kernel.org> # 3.9+ Reported-by:
2003 Aug 16
1
equivalent of Splus command axis(..., srt=45, adj=1) in R
Dear R-users moving from Splus to R (under Windows), I notice that command "srt" within a plot in the original Splus code is ignored by R. For example, if a plot something and then include the line of code axis(1, at=Time, labels=Text, srt=45, adj=1) the srt=45 command within the axis() command fails to draw Text at 45 degrees on the x-axis in R but it works properly in Splus. I will