To make some sense of the mess I made in the comments.
You were trying to reproduce the example from the SummarizedExperimet vignette. Let's see what each statement does:
nrows <- 200
ncols <- 6
This line constructs a count matrix with random values from the uniform distribution. The number of rows is the number of genes, columns are samples:
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
This one defines the genes' chromosomal locations (you skipped it which is fine)
rowRanges <- GRanges(rep(c("chr1", "chr2"), c(50, 150)),
IRanges(floor(runif(200, 1e5, 1e6)), width=100),
strand=sample(c("+", "-"), 200, TRUE),
Here they build the metadata table with one row for each sample (6) and they give each row one parameter, namely the Treatment which is either ChIP or Input
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
Now build the container:
The part you're failing on is generating the metadata. If you have your own data then you should put it in a count matrix and generate the metadata table properly with the correct dimensions.
Needless to say, there are packages that can generate SummarizedExperiment for you for some data sets.