Questions tagged [replicate]
280 questions
0
votes
2 answers
SAS - Replicate multiple observations across rows
I have a data structure that looks like this:
DATA have ;
INPUT famid indid implicate imp_inc;
CARDS ;
1 1 1 40000
1 1 2 25000
1 1 3 34000
1 1 4 23555
1 1 5 49850
1 2 1 1000
1 2 2 2000
1 2 3 3000
1 2 4 4000
1 2 5 5000
1 3 1 .
1 3 2 .
1 3 3 .
1 3…

Luis Martins
- 19
- 9
0
votes
1 answer
replicate columns in R
Let's consider the data set iris.
>iris
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
…

Chu
- 17
- 6
0
votes
1 answer
Replicating Row in Table if Data doesn't Exist
I currently have a sql-server database with data revolving around watt generation per second. The watt data is normally saved in second intervals, but sometimes there are inconsistencies where it is saved by a minute interval instead. Thus, instead…

iporollo
- 25
- 5
0
votes
2 answers
Replicate changes of 1 fork to others
here we have lots of forks.
We have a product that is a base, and the client can custumize it a lot.
Every fork is a product, but their structure are very different, and sometimes we need to replicate some changes to our base product.
Right now I…
0
votes
1 answer
Replicating a plot in R
I am solving a task for my R online course. The task is to create and save the following pdf-file by given the functions of X and Y and test it with Reg(50) and set.seed(1423):
The first step is to create the basic Reg()-function, that creates only…

Rio
- 99
- 4
- 12
0
votes
1 answer
How to replicate a function 1000 times
So basically, I generated 2 random variables X and Y 1000 times and created a data frame Data=data.frame(x,y) in order to perform a smoothing by spline function. Now I want to recreate exactly that but for B= 1000 times and plot the smoothing…

Jng
- 51
- 1
- 6
0
votes
2 answers
How to call up different dataframes in loops in r and add to them different computational results?
How can I automate the steps below?
I have the following example of what I would like to do - in the end get a dataframe made up of smaller dataframes that are generated automatically in earlier steps. These smaller dataframes need also…

Mary
- 41
- 5
0
votes
2 answers
R replicate() function doesnt work on Rcpp function
I am having trouble using replicate() function in R to generate random numbers with Rcpp function. Consider the following function in R:
trial <- function(){rnorm(1)}
replicate(10, trial())
It generate 10 random numbers from Gaussian distribution.…

John
- 309
- 3
- 12
0
votes
1 answer
One-liner to create a list of iterating sequences?
I need to create a list of sequences that always goes back to the first digit in the sequence. I've written the code below but it seems clunky. Is there a solution that uses fewer characters?
(i = seq(1, 24, by = 3))
#> [1] 1 4 7 10 13 16 19…

RobinLovelace
- 4,799
- 6
- 29
- 40
0
votes
2 answers
How do I stop the replicate() function from printing all results in R?
I am new to R and I have a small issue. I have the following code for my slot machine in R (from the "hands-on programming with R" from Garrett Grolemund.
When I use the play() function for my slot machine that you can see below, I get a single…

JachymDvorak
- 129
- 8
0
votes
1 answer
Matrix Creation and Assignment in Matlab
I have two matrices A fixed size, B grows iterationwise. How to create matrix B of equal size as A, but to be enlarged/manipulated according to the vector 'j'.
Cases 1) Size B< Size A, 2) Size B=Size A, 3) Size B> Size A. First case is…

user9003011
- 306
- 1
- 10
0
votes
1 answer
reformat data frame in R
I am new to R.
I need to reformat the following data frame:
`Sample Name` `Target Name` 'CT values'
1 Sample 1 actin 19.69928
2 Sample 1 Ho-1 27.71864
3 Sample 1 …

ic23oluk
- 125
- 1
- 9
0
votes
1 answer
Generating a matrix of ascending values, after every 2 rows, without a for loop in R
I'm trying to generate this matrix without using a for loop (to speed up the processing time):
Module 1 Module 2 Module 3
y0 20 20 20
y1 20 20 20
y0 40 40 40
y1 40 40 …

MBorg
- 1,345
- 2
- 19
- 38
0
votes
1 answer
simulations In R with apply and replicate
I have two matrices One that contains all the mean values and another that contains all the standard deviations. I want to simulate a random number for each of the three investors and see which investor gets the highest.
For example:- Loan 1 has…

Kish
- 1
- 2
0
votes
2 answers
Why won't my for loop iterate over the whole list?
Essentially, I am taking a list of emotions and trying to replicate each emotion on the list 6 times and then add them to a vector. For example:
emotions<-c("Happy","Sad","Angry")
will look…

Andrew Colin
- 155
- 1
- 11