-2

I want to fill the dataset "TEAM" with a new column , and at each row I want to input a random value from lets say a vector of integers (1, 1729, 4679, 10257). My end goal is to link two datasets TEAMS and LEAGUES.

csgroen
  • 2,511
  • 11
  • 28
  • 1
    Welcome to SO! You can use the `sample` function with replacement to get as many numbers from a vector as you like. If you need more help than that, you'll need to be more specific – csgroen Apr 11 '18 at 19:38
  • 1
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Is there a reason this is tagged with "sql" and "mysql"? Id your data in a database? – MrFlick Apr 11 '18 at 19:45

1 Answers1

0

Look into sample

TEAM$new_column <- sample(c(1,1729,4679,10257),nrow(TEAM), replace = T)
jasbner
  • 2,253
  • 12
  • 24