similar to: replacing duplicate rows

Displaying 20 results from an estimated 10000 matches similar to: "replacing duplicate rows"

2010 Nov 14
2
replace a row in a matrix
Dear all, I created a n*2 matrix and I want to replace the ith row with a vector. Can anyone suggest me what is the simple way to do it? Sorry for bothering you with such simple question. I appreciate any hints or advice. Thanks in advance. Cassie [[alternative HTML version deleted]]
2007 Apr 11
1
Programming Problem (for loop, random # control, 3 dimentional graph)
Dear List, This is just a programming problem which i cannot seem to figure out. I am trying to get a set of power from a test (say, kolmogorov smirnov) out of a distribution (say, G-K distribution) as follows. I am trying to reduce to pain of writing the whole set of data points (p# below) using "for" loop. However, I seem to have some problem in it as the output "M" does not
2010 Apr 16
3
VERY SIMPLE QUESTION
Dear R users, I am looking for more efficient way to compute the followings -------------------------------------------------------------------------- a <- matrix(c(1,1,1,1,2,2,2,2),4,2) b <- matrix(c(1,2,3,4),4,1) Eventually, I want to get this matrix, `c`. c <- matrix(c(1/1,1/2,1/3,1/4,2/1,2/2,2/3,2/4),4,2) --------------------------------------------------------------------------
2024 Dec 01
6
Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows
Dear R help folks, First my apologizes for sending several related questions to the list server. I am trying to learn how to manipulate data in R . . . and am having difficulty getting my program to work. I greatly appreciate the help and support list member give! I am trying to write a program that will run through a data frame organized by ID and for the first line of each new group of data
2012 Jan 30
4
replacing characters in matrix. substitute, delayedAssign, huh?
A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names. So that has to be a character matrix. Consider: > BM <- matrix("0.1", 5, 5) Use data.entry(BM) or similar to set some to more abstract values. > BM[3,1] <- "a" > BM[4,2] <- "b" >
2010 Nov 09
2
simulation from pareto distn
Dear all, I am trying to simulate from truncated Pareto distribution. I know there is a package called PtProcess for Pareto distribution...but it is not for truncated one. Can anyone please help me with this? Thanks in advance. Cassie [[alternative HTML version deleted]]
2011 Apr 08
4
Simulation from discrete uniform
Dear all, I am trying to simulate from discrete uniform distribution. But I could not find any in-built code in R. Could anyone help me please? Thanks in advance for the time and help. Cassie [[alternative HTML version deleted]]
2009 Sep 21
2
Four concurrent Markov chains
Hi, I am trying to write a simulation of the movements of four animals between six patches. The movement between patches is based on a first-order Markov chain so that the next patch they visit depends on the patch they were in before. I have written code that allows me to simulate the movement of one animal but when I add more there seems to be a problem and all chains come back as N/A. I can
2012 Jul 26
5
Getting warning message
Hi Friends, I have a data frame X, and I want to add ?%? & ?$? in row 4 and 5 respectively. when I?m trying using below logic, I?m getting warning message. Can anyone help me out on this. X: Summary G Y R T Accts 582 644 0 1226 AcctCov 230 165 0 395 Cov% 40 26 0 32 UnCov% 60 74 0 68 EqVol11$MM8.5 10.6 0 19.1 Using this logic:
2009 Mar 06
1
GoSub & Queue
I have a caller screen queue setup. Basically a caller calls in, goes through a IVR, and before that caller is put into the queue, they get a sub ran on them first asking for them to say there name. That gets saved and they are entered into the queue using Queue(mainqueue,,,,300). In the queues.conf i have a list of members these are local/extension at external-default, there are two
2012 Aug 01
3
Can any one help me on this Issue
Hi Friends, I'm new to R ,I have a data frame Z16 which is genarated from another data frame, and I want to add ?%? & ?$? in row 4 and 5 respectively. when I?m trying using below logic, I?m getting warning message. I'm using R 2.14.2 Version Can anyone help me out on this. Note: Initially i used tranfrom function to do some calculations,where ever it should give zero,its
2012 Apr 10
1
how to convert seconds to 12 hour time format
Hello everyone, I am wondering if there is any routine in R which can convert time given in 'seconds' unit to the 12 hour time format. For example, suppose the data set looks like x=c(36885,84000,20) #x in seconds I want to get the output as [1] " 11:14:45 AM" [2] " 11:20:00 PM" [3] "12:20:00 AM" Does anyone have any idea? Thanks in advance. Cassie
2004 Jul 23
4
hang up when going to voicemail
I have a little menu set up where hitting 1, 2, or 3 places the call through to a cellular phone over IAX. That works. However, if caller hits 4 to go into voicemail, the system hangs up. Am I doing something wrong in the dial plan, or is this a CVS change? I had no trouble with this until I upgraded to about 07/21 CVS, and I'm on 07/23 [latest] now with same results. My dial plan:
2010 Jul 29
2
Fry Plots
Does anyone know how to do a fry plot in R? I have 600-800 points per image, and I really don't want to attempt that manually. Thank you! Cassie [[alternative HTML version deleted]]
2024 Nov 27
7
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement: I want to take data (olddata) that looks like this ID Day 1 1 1 1 1 2 1 2 1 3 1 3 1 4 1 4 1 5 1 5 2 5 2 5 2 5 2 6 2 6 2 6 3 10 3 10 and make it look like this: (withing each
2010 Sep 29
1
executing loop
Dear All, I am trying to define a loop for a m*n matrix, where i=1:n and j=1:m. Unlike the usual for loop, i should go in the following way: For j=1, i=1,2,3,....n For j=2, i=n,n-1,n-2,......,1 For j=3, i=1,2,3,.....n etc. which means i should go in either increasing or decreasing order alternatively. Can anyone please help me in doing this? Thanks, Cassie [[alternative HTML version
2008 Dec 26
3
Problem: no such extension 'xx' in context 'default'
Hi Guys, I am not so familiar with asterisk and hope to get help here. I am having now some stupid errors. My goal for the first, is to create a simple pbx with different context. As long as I use only the contex 'default' everything seems to work perfect. Now I tried to add another context i.e 'internal' and the asterisk is complaining for not finding the required extension in
2024 Nov 27
4
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
Check out the dplyr package, specifically the mutate function. # Create new column based on existing column value df <- df %>% mutate(FirstDay = if(ID = 2, 5)) df Repeat as needed to capture all of the day/firstday combinations you want to account for. Like everything else in R, there are probably at least a dozen other ways to do this, between base R and all of the library packages
2024 Dec 01
2
Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows
Rui: "f these two, diff is faster. But of all the solutions posted so far, Ben Bolker's is the fastest." But the explicit version of diff is still considerably faster: > D <- c(rep(1,10),rep(2,6),rep(3,2)) > microbenchmark(c(1L,diff(D)), times = 1000L) Unit: microseconds expr min lq mean median uq max neval c(1L, diff(D)) 3.075 3.198 3.34396
2015 Mar 09
2
Calculos matrices diferentes tamaños
Buen Día Jorge, Es algo parecido a lo que necesito, pero no debo tener en cuenta la suma de la columna sino por ejemplo: Tengo el elemento [1,2] en la matriz A que contiene el número 5 y por otra parte tengo la columna [,2] de la Matriz B con valores por ejemplo (1,2,3,4,5,6,7,8,9,10,11,12). El resultado debería ser un vector que en la posición uno debe indicar que existen 7 valores mayores a 5