search for: nx2

Displaying 20 results from an estimated 37 matches for "nx2".

Did you mean: 0x2
2008 Oct 22
3
coalesce columns within a data frame
...merge", "cbind" and terms like "coalesce" with no success). There surely is a way to coalesce (like in SQL) columns in a dataframe, right? For example, I would like to go from a dataframe with two columns to one with only one as follows: From Name.x Name.y nx1 ny1 nx2 NA NA ny3 NA NA ... To Name nx1 nx2 ny3 NA ... where column Name.x is taken if there is a value, and if not then column Name.y Any help would be appreciated Kind regards, Ivan
2010 Jun 18
4
Drawing sample from a circle
Hi, I would like to draw 10 uniformly distributed sample points from a circle with redius one and centered at (0,0). Is there any R function to do that?   Thanks, [[alternative HTML version deleted]]
2005 Mar 18
4
passing arguments to FUN in lapply
Suppose I have a nx2 matrix of data, X, the following code generate density estimation for each column and plot them denlist <- apply(X, 2, density) par(mfrow=c(1,2)) lapply(denlist, plot) Does anyone know how to change the main title of each density plot to "var 1", "var 2" by passing optional...
2003 Aug 04
1
Novice question
...s for known x's1 and x's2 ys <- c(133890, 135000, 135790, 137300, 138130, 139100, 139900, 141120, 141890, 143230, 144000, 145290) xs1 <- c(1:12) xs2 <- c(22, 24.5, 27, 33, 36.8, 40, 44, 57, 59, 62, 74, 77) xm <- cbind(xs1, xs2) -- New x's1 and x's2 nx1 <- c(13:17) nx2 <- c(82, 85, 88.3, 90, 95) -- Generate some predictions samples <- data.frame(xs1=nx1, xs2=nx2) f <- predict(lm(ys ~ xm), samples) data.frame(f) yields: f 1 133949.8 2 134970.2 3 135990.6 4 137008.1 5 138027.5 6 139047.3 7 140066.5 8 141078.3 9 142099.1 10 143119.1 11...
2005 May 20
4
issues with identical()
Hi all, hope you having a nice day, I ahve this weird results with identical (probably I am not understanding correctly what it does ...) I have these two data frames and I issue : > identical(temp, temp1) [1] FALSE However, these data frames are Nx2 and when I issue: > identical(temp[,2], temp1[,2]) [1] TRUE > identical(temp[,1], temp1[,1]) [1] TRUE and the results from str > str(temp) `data.frame': 7072 obs. of 2 variables: $ pub_id : int 10000 1000 10001 10002 10003 10004 10005 10006 10007 $ faminc90: int -2 5998 19900...
2010 Jul 06
2
How do I plat timestamed (in seconds) data in R?
Hi all, I have an Nx2 array, where the first column contains the timestamps and the second column contains the corresponding data. second | ts --------| -- 14:25:00| 18 14:25:02| 14 14:25:04| 11 14:25:06| 4 14:25:08| 24 14:25:10| 13 14:25:12| 12 14:25:14| 6 14:25:16| 21 14:25:18| 37 14:25:20| 21 14:25:22| 9 Since I d...
1997 Sep 05
2
R-beta: help with R simulation
...preciated! (I am using Mac version of R) Bill Simpson # nearest neighbour distance simulation # for dynamic noise dots do.sim<-function(nnoise, nsignal, jump) { ntotal<-nsignal+nnoise x<<-NULL y<<-NULL x.temp<-0 y.temp<-0 #generate noise dots nx1<-runif(nnoise,0,4095) nx2<-runif(nnoise,0,4095) ny1<-runif(nnoise,0,4095) ny2<-runif(nnoise,0,4095) #generate signal dots sx1<-runif(nsignal,0,4095) sx2<-sx1 sy1<-runif(nsignal,0,4095) sy2<-sy1+jump sy2<-ifelse(sy2>4095, sy2-4096,sy2) #wrap around #put noise and signal dots together tx1<-c(nx...
2001 Apr 20
1
tapply on a matrix?
suppose i have an nx2 matrix A; call its column vectors x and y. the rows of A are grouped by a factor F. i want to fit one lowess curve (y vs. x) for each subset of rows corresponding to a particular level of F. naively, i mean something like tapply(A, F, fun = lowess) , but tapply needs A to be 1-dimensional. readi...
2008 Feb 15
1
help on loop function
Dear lists, Anysuggestion on how to write a loop function which has nx2 matrix as an input, where each of the row represents an interval. the function should return a mx2 matrix containing the no matched interval of x?? i've tried my own function but it's only applies for 2x2 matrix. Here is my code: overlap<-function(x,y){ m=length(x) n=length(...
2003 Oct 31
1
samba3 and CUPS: lpoptions does not work
Hi, I have set up a CUPS queue in the samba server with specific lpoptions (actually, it's a queue to print 2-up on an HP LaserJet4300 printer. I used lpoptions -d NX2-118 -o number-up=2). Everything works as expected when I print from the Unix side. However, when I print to the corresponding samba queue, the options specified through lpoptions are ignored (i.e. the prints come out as 1-up instead of 2-up). I am using samba-3.0.1-pre1 on a RedHat9 system, with...
2011 Dec 17
1
Binning a 2 column matrix by avarages of rows.
Newbie here. Many apologies in advance for using the incorrect lingo. I'm new to statistics and VERY new to R. I have a "nx2" matrix , I want to sort the values based on the average of 2 columns and put k lowest (or highest) values in bin1, second k high/low values in bin2, and so on (bins would be of the same dimensions). I should also know what the first index (or position) of the pair has been. car-1 29 30 car-...
2011 Dec 22
1
Union/Intersect two continuous sets
Dear All, It is my first time using this mail list to post a question. And I sincerely hope that this will not bother any subscribers. So far as I know, there are functions like union( ), which can help to combine two sets of discrete data. But what if the data sets are with continuous data. For instance, I got three sets like [2, 4], [5, 6], [3.4, 5.5]. I wonder if there is a quick solution to
2006 Jul 22
1
Why the contrain does not work for selecting a particular range of data?
Dear: Continuing the issue of 'ifelse'! I selecting the data whose 'x2'=1 for maximizing likelihood. I used two way to do this but the results are different. 1.Way one I use the data for x2=1 and run the program. It works for me. Tthe program is described as below: function (parameters,y1,x11) { p<-parameters[1] alpha1<-parameters[2] beta1<-parameters[3]
2010 Jul 20
1
apply: return list of matrices
...;- factor(bc) table(bc[1:(n/2)], bc[(n/2+1):n]) } ct returns a 2x2 table giving the contingency counts. f <- function(p, b) { allC <- t(combn(levels(as.factor(p)), 2)) bRaw <- apply(allC, 1, function(x) cbind(b[p==x[1]], b[p==x[2]])) # bRaw would preferable be already a list of nx2 matrices, but apply coerces the result to a single matrix, # whose columns are rbind(b[p==x[1]], b[p==x[2]]), that's why "ct" takes just one argument and splits the vector apply(bRaw, 2, ct) } Again the result is one single matrix instead of list of matrices (the columns consis...
2019 Jul 22
3
[RFC] A new multidimensional array indexing intrinsic
...t; > according to C semantics, the two indices alias if the _flattened > > representation of the indices alias_. Consider the parameter > > values: > > > > ``` > > n = m = 3 > > x1 = 1, y1 = 0; B[x1][y1] = nx1+y1 = 3*1+0=3 > > x2 = 0, y2 = 3; B[x2][y2] = nx2+y2 = 3*0+3=3 > > ``` > > > > Hence, the array elements `B[x1][y1]` and `B[x2][y2]` _can alias_, and > > so the transformation proposed in `ex1_opt` is unsound in general. > > I'm unsure your example actually showcases the problem: > > C standard, N1570 draft,...
2000 Jul 07
1
reorganizing a data frame
Hi, I have what I think is an easy question. I have a data frame, called stockdata, of stock prices that looks like this: date ticker close 1 01/02/1998 GE 24.667 2 01/05/1998 GE 25.104 3 01/06/1998 GE 24.771 4 01/07/1998 GE 24.979 5 01/08/1998 GE 24.750 6 01/02/1998 HIT 71.125 7 01/05/1998 HIT 72.313
2003 Apr 03
0
How to estimate 2-D principal curve using PCURVE?
Hey, R-listers I am a new user of R and just found the package of PCURVE which can estimate principal curve for arbitrary dimensional data set. Now I have some 2-Dimensional data set X, which is stored as an Nx2 matrix in data.txt file and looks as following: -1.5551 2.4183 1.0051 1.0102 0.90644 0.82163 1.3248 1.7551 -1.3626 1.8568 -1.3554 1.8371 0.039396 0.0015521 -0.99622 0.99245 0.2314 0.053544 1.4127 1.9956 1.3814 1.9083 0.83861 0.70326 -1.045 1.092 -1.8073 3.2665 0.54591 0.29801 -0.69022 0.47641 -0.70...
1998 Jan 20
1
prlab
Andreas Weingessel <Andreas.Weingessel@ci.tuwien.ac.at> writes: > When I tried to port the statlib-Pkg rpart to R, I came across the > c-Function prlab which seems to be part of S+, but not of R. > > Does anyone know what prlab does and how difficult it would be to > emulate it in R? Can you show us the context? If I had to guess I would say it was a routine to print
2018 Apr 05
1
Turn off replication
We have a Gluster setup with 2 nodes (distributed replication) and we would like to switch it to the distributed mode. I know the data is duplicated between those nodes, what is the proper way of switching it to a distributed, we would like to double or gain the storage space on our gluster storage node. what happens with the data, do i need to erase one of the nodes? Jose
1998 Jul 09
1
numeric(0) -> NA
...(0) > floor(runif(0,0,4095)) numeric(0) which leads me to thing round() is not working right. I have some code like this: do.sim<-function(nnoise, nsignal, jump) { ntotal<-nsignal+nnoise x<-numeric(ntotal) y<-numeric(ntotal) #generate noise dots nx1<-round(runif(nnoise,0,4095)) nx2<-round(runif(nnoise,0,4095)) ny1<-round(runif(nnoise,0,4095)) ny2<-round(runif(nnoise,0,4095)) #generate signal dots sx1<-round(runif(nsignal,0,4095)) ... and I need to do do.sim(0,1000,10). But that gives me NAs which are a problem later. (in particular, I can't do if(rr<rbest...