Vector | R Tutorial

R Tutorial

An R Introduction to Statistics

  • About
  • Contact
  • Resources
  • Terms of Use
  • Home
  • Download
  • Sales
  • eBook
  • Site Map
Vector

A vector is a sequence of data elements of the same basic type. Members in a vector are officially called components. Nevertheless, we will just call them members in this site.

Here is a vector containing three numeric values 2, 3 and 5.

> c(2, 3, 5) [1] 2 3 5

And here is a vector of logical values.

> c(TRUE, FALSE, TRUE, FALSE, FALSE) [1]  TRUE FALSE  TRUE FALSE FALSE

A vector can contain character strings.

> c("aa", "bb", "cc", "dd", "ee") [1] "aa" "bb" "cc" "dd" "ee"

Incidentally, the number of members in a vector is given by the length function.

> length(c("aa", "bb", "cc", "dd", "ee")) [1] 5
  • Combining Vectors
  • Vector Arithmetics
  • Vector Index
  • Numeric Index Vector
  • Logical Index Vector
  • Named Vector Members
‹ Character up Combining Vectors › Tags:
  • R Introduction
  • c
  • length
Search this site:

R Tutorial eBook

R Tutorial eBook

R Tutorials

  • R Introduction
    • Basic Data Types
      • Numeric
      • Integer
      • Complex
      • Logical
      • Character
    • Vector
      • Combining Vectors
      • Vector Arithmetics
      • Vector Index
      • Numeric Index Vector
      • Logical Index Vector
      • Named Vector Members
    • Matrix
      • Matrix Construction
    • List
      • Named List Members
    • Data Frame
      • Data Frame Column Vector
      • Data Frame Column Slice
      • Data Frame Row Slice
      • Data Import
  • Elementary Statistics with R
    • Qualitative Data
      • Frequency Distribution of Qualitative Data
      • Relative Frequency Distribution of Qualitative Data
      • Bar Graph
      • Pie Chart
      • Category Statistics
    • Quantitative Data
      • Frequency Distribution of Quantitative Data
      • Histogram
      • Relative Frequency Distribution of Quantitative Data
      • Cumulative Frequency Distribution
      • Cumulative Frequency Graph
      • Cumulative Relative Frequency Distribution
      • Cumulative Relative Frequency Graph
      • Stem-and-Leaf Plot
      • Scatter Plot
    • Numerical Measures
      • Mean
      • Median
      • Quartile
      • Percentile
      • Range
      • Interquartile Range
      • Box Plot
      • Variance
      • Standard Deviation
      • Covariance
      • Correlation Coefficient
      • Central Moment
      • Skewness
      • Kurtosis
    • Probability Distributions
      • Binomial Distribution
      • Poisson Distribution
      • Continuous Uniform Distribution
      • Exponential Distribution
      • Normal Distribution
      • Chi-squared Distribution
      • Student t Distribution
      • F Distribution
    • Interval Estimation
      • Point Estimate of Population Mean
      • Interval Estimate of Population Mean with Known Variance
      • Interval Estimate of Population Mean with Unknown Variance
      • Sampling Size of Population Mean
      • Point Estimate of Population Proportion
      • Interval Estimate of Population Proportion
      • Sampling Size of Population Proportion
    • Hypothesis Testing
      • Lower Tail Test of Population Mean with Known Variance
      • Upper Tail Test of Population Mean with Known Variance
      • Two-Tailed Test of Population Mean with Known Variance
      • Lower Tail Test of Population Mean with Unknown Variance
      • Upper Tail Test of Population Mean with Unknown Variance
      • Two-Tailed Test of Population Mean with Unknown Variance
      • Lower Tail Test of Population Proportion
      • Upper Tail Test of Population Proportion
      • Two-Tailed Test of Population Proportion
    • Type II Error
      • Type II Error in Lower Tail Test of Population Mean with Known Variance
      • Type II Error in Upper Tail Test of Population Mean with Known Variance
      • Type II Error in Two-Tailed Test of Population Mean with Known Variance
      • Type II Error in Lower Tail Test of Population Mean with Unknown Variance
      • Type II Error in Upper Tail Test of Population Mean with Unknown Variance
      • Type II Error in Two-Tailed Test of Population Mean with Unknown Variance
    • Inference About Two Populations
      • Population Mean Between Two Matched Samples
      • Population Mean Between Two Independent Samples
      • Comparison of Two Population Proportions
    • Goodness of Fit
      • Multinomial Goodness of Fit
      • Chi-squared Test of Independence
    • Analysis of Variance
      • Completely Randomized Design
      • Randomized Block Design
      • Factorial Design
    • Non-parametric Methods
      • Sign Test
      • Wilcoxon Signed-Rank Test
      • Mann-Whitney-Wilcoxon Test
      • Kruskal-Wallis Test
    • Simple Linear Regression
      • Estimated Simple Regression Equation
      • Coefficient of Determination
      • Significance Test for Linear Regression
      • Confidence Interval for Linear Regression
      • Prediction Interval for Linear Regression
      • Residual Plot
      • Standardized Residual
      • Normal Probability Plot of Residuals
    • Multiple Linear Regression
      • Estimated Multiple Regression Equation
      • Multiple Coefficient of Determination
      • Adjusted Coefficient of Determination
      • Significance Test for MLR
      • Confidence Interval for MLR
      • Prediction Interval for MLR
    • Logistic Regression
      • Estimated Logistic Regression Equation
      • Significance Test for Logistic Regression
  • GPU Computing with R
    • Distance Matrix by GPU
    • Hierarchical Cluster Analysis
    • Kendall Rank Coefficient
    • Significance Test for Kendall's Tau-b
    • Support Vector Machine with GPU
    • Support Vector Machine with GPU, Part II
    • Bayesian Classification with Gaussian Process
    • Hierarchical Linear Model
    • Installing GPU Packages

Copyright © 2009 - 2025 Chi Yau All Rights Reserved Theme design by styleshout Adaptation by Chi Yau

Tag » How To Create A Vector In R