The line:
X1<-runif(188)
initializes X1 with 188 values. If you’re indexing X1[189], there is an error.
Try this:
print (X1[189])
> NA
In order to correct it, just change your runif:
X1<-runif(500)
More Related Contents:
- Extract rows based on only one column using R [closed]
- Naming columns in a data table in R
- Split data frame string column into multiple columns
- How do I arrange a variable list of plots using grid.arrange?
- Selecting only numeric columns from a data frame
- Use of ~ (tilde) in R programming Language
- Conditional merge/replacement in R
- Split text string in a data.table columns
- Collapsing data frame by selecting one row per group
- ggplot2 pie and donut chart on same plot
- Rotate a Matrix in R by 90 degrees clockwise
- gsub() in R is not replacing ‘.’ (dot)
- How do I override a non-visible function in the package namespace?
- R help page as object
- Install Rtools on R version 3.0.2
- How to pass dynamic column names in dplyr into custom function?
- Convert a character vector of mixed numbers, fractions, and integers to numeric
- Options for caching / memoization / hashing in R
- Line break in expression()?
- Library is not writable
- R – when trying to install package: InternetOpenUrl failed
- R – Markdown avoiding package loading messages
- Is it possible to get the number of rows in a CSV file without opening it?
- How to stop bookdown tables from floating to bottom of the page in pdf?
- Elegant way to select the color for a particular segment of a line plot?
- Function to concatenate paths?
- How can I label points in this scatterplot?
- Error when using predict() on a randomForest object trained with caret’s train() using formula
- Convert two-digit years to four-digit years with correct century
- Dealing with very small numbers in R