Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

R - how to repeat sequence 1 to 522

$
0
0

I have two files ones with 522 project id that I want to extract from the first file.

the following code works for extracting but I don't want to repeat manually 522 times the data$projectID==datid[x, ] |

data1 = data[(data$projectID==datid[1, ] |data$projectID==datid[2, ]|  ...| data$projectID==datid[522, ]), ]

How to repeat the instruction 522 times adding one each time.

Thanks!!

data = read.csv("~/Desktop/PACA SNA/PACA3.csv", header = TRUE, sep =";")

datid= read.csv("~/Desktop/PACA SNA/PACAID.csv", header = FALSE, sep =";")

data1 = data[(data$projectID==datid[1, ] | ...| data$projectID==datid[522, ]), ]

Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>