Questions tagged [replicate]

280 questions
1
vote
3 answers

Generating a vector with n repetitions of x, then y, then z, with a fixed upper bound

I am trying to create a vector where I have 3 repetitions of the number 1, then 3 repetitions of the number 2, and so on up to, for instance, 3 repetitions of the number 36. c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5...) I have tried the following use of…
Cameron
  • 85
  • 6
1
vote
1 answer

How to generate a script to create all tables with different schema

I have about 200 tables in a schema. I need to replicate these tables in a new backup schema with an automatic procedure. I would like to create a procedure to dynamically recreate all the Tables in a Schema (potentially dynamic number of tables and…
1
vote
4 answers

Separating Parameters in Repeated Function Calls

With a vector of values, I want each value to be called on a function values = 1:10 rnorm(100, mean=values, sd=1) mean = values repeats the sequence (1,2,3,4,5,6,7,8,9,10). How can I get a matrix, each with 100 observations and using a single…
TVB22
  • 47
  • 3
1
vote
2 answers

R - Identifying only strings ending with A and B in a column

I have a column in a data frame in R that contains sample names. Some names are identical except that they end in A or B at the end, and some samples repeat themselves, like this: df <- data.frame(Samples = c("S_026A", "S_026B", "S_028A", "S_028B",…
Purrsia
  • 712
  • 5
  • 18
1
vote
1 answer

How to replicate/ copy pandas dataframe rows

I need to copy the same block of rows 3 times exact below this blocks. Like below example. DataFrame (df1):- S.No Cal Date DFM 1 8 01-03-2013 100.00% 1 7 01-06-2013 100.00% 1 …
Yaser
  • 61
  • 6
1
vote
1 answer

Python - Replicate rows in Pandas Dataframe based on condition

I have a Pandas DataFrame on which I need to replicate some of the rows based on the presence of a given list of values in certain columns. If a row contains one of these values in the specified columns, then I need to replicate that row. df =…
Fsanna
  • 347
  • 1
  • 4
  • 11
1
vote
2 answers

How to check if the value "TRUE" occurs consecutively for x number of times in R?

I am trying to find 'x' or more consecutive missing dates for each group in R. My current approach involves: Using a for loop over each group Find missing dates Find how many of these missing dates are consecutive (here I get a logical vector,…
1
vote
1 answer

R - copy values from cells to empty cells within same columns

I have a dataset with answers to a likert scale and reaction times that are both results of a experimental manipulation. Ideally I would like to copy the Likert_Answer values and align them to the experimental manipulation associated with that…
Lucas
  • 51
  • 6
1
vote
3 answers

Iterate through times argument in rep()-function and store result in new variable in R

I have a dataframe which looks like this: > df 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 1 6 0 0 0 0 0 3 0 0 0 0 0 0 1 I try to replicate the number 1540 by the entries in the df and store them in length(df) new variables. So,…
sdaniel24
  • 25
  • 5
1
vote
0 answers

Azure Synapse , REPLICATED TABLE

I Create a small dummy table(with 1728 rows) with Distribution as "REPLICATE" " Create table complaints_stg.Employee4 with ( clustered columnstore index, Distribution = REPLICATE ) as select * from #abc " but when i do " DBCC…
amar
  • 11
  • 1
1
vote
1 answer

Replicate specific rows and separate str column values pandas

I have the following dataframe index city pop 1 London 1000 2 Buenos Aires 2054 3 New York 34544 4 Paris-Madrid 34343 5 Barcelona-Lagos 64544 What I expect to do: index city …
jimmy
  • 340
  • 2
  • 13
1
vote
1 answer

How to use the replicate function in R to repeat the function

I have a problem when using replicate to repeat the function. I tried to use the bootstrap to fit a quadratic model using concentration as the predictor and Total_lignin as the response and going to report an estimate of the maximum with a…
Fox_Summer
  • 149
  • 6
1
vote
1 answer

Create a function that replicates other function 100 times

I am trying to create a function that replicates 100 times other two functions and then calculate the average of the those values. I have a matrix like this: str(pref) #num [1:9, 1:158] 4 9 15 6 7 8 6 11 11 4 ... #- attr(*, "dimnames")=List of 2 #…
rodrigarco
  • 123
  • 1
  • 9
1
vote
1 answer

How replicate () an apply process with random function inside in r?

I want to run several times (B times, suppose) an apply that gives me a data.frame based on a random data generated by another function. I want to do that without a for-loop (I've tried using for and it works but I want to do it with replicate() or…
1
vote
1 answer

Replicate rows and columns in pandas Dataframe

I would like to expand and replicate rows and columns multiple times (30 times) in a pandas DataFrame, which has 36 columns and 28 rows. Thus the result should be a 1.080 x 840 matrix. Example: ARG BRA BRN AUS 2.93 3.06 3.56 AUT…
Alexander Hempfing
  • 247
  • 1
  • 2
  • 9