Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Answers to the exercises are available here.

Exercise 1

Consider two vectors, `x, y`
`x=c(4,6,5,7,10,9,4,15)`
`y=c(0,10,1,8,2,3,4,1)`

What is the value of: `x*y`

Exercise 2

Consider two vectors, `a, b`

`a=c(1,2,4,5,6)`
`b=c(3,2,4,1,9)`
What is the value of: `cbind(a,b)`

Exercise 3

Consider two vectors, `a, b`

`a=c(1,5,4,3,6)`
`b=c(3,5,2,1,9)`
What is the value of: `a<=b`

Exercise 4

Consider two vectors, `a, b`

`a=c(10,2,4,15)`
`b=c(3,12,4,11)`
What is the value of: `rbind(a,b)`

Exercise 5

If `x=c(1:12)`
What is the value of: `dim(x)`
What is the value of: `length(x)`

Exercise 6

If `a=c(12:5)`
What is the value of: `is.numeric(a)`

Exercise 7

Consider two vectors, `x, y`

`x=c(12:4)`
`y=c(0,1,2,0,1,2,0,1,2)`
What is the value of: `which(!is.finite(x/y))`

Exercise 8

Consider two vectors, `x, y`

` x=letters[1:10]`
`y=letters[15:24]`
What is the value of: `x`

`Exercise 9`

`If x=c('blue','red','green','yellow') What is the value of: is.character(x)`

`Exercise 10`

`If x=c('blue',10,'green',20) What is the value of: is.character(x)`

`Want to practice vectors a bit more? We have more exercise sets on this topic here.`

``` var vglnk = {key: '949efb41171ac6ec1bf7f206d57e90b8'}; (function(d, t) { var s = d.createElement(t); s.type = 'text/javascript'; s.async = true; s.src = '//cdn.viglink.com/api/vglnk.js'; var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r); }(document, 'script')); RelatedShareTweetTo leave a comment for the author, please follow the link and comment on their blog: R-exercises. R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.```
``` [{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/www.r-bloggers.com#Organization","name":"R-bloggers","url":"http:\/\/www.r-bloggers.com","sameAs":[],"logo":{"@type":"ImageObject","url":"http:\/\/www.r-bloggers.com\/wp-content\/uploads\/2020\/07\/R_blogger_logo_02.png","width":"1061","height":"304"},"contactPoint":{"@type":"ContactPoint","contactType":"technical support","telephone":"","url":"https:\/\/www.r-bloggers.com\/contact-us\/"}},[],{"@context":"https:\/\/schema.org","@type":"WebPage","@id":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/#webpage","name":"Vectors Vol. 2 Exercises | R-bloggers","url":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/","lastReviewed":"2016-11-15T11:00:16-06:00","reviewedBy":{"@type":"Organization","logo":{"@type":"ImageObject","url":"http:\/\/www.r-bloggers.com\/wp-content\/uploads\/2020\/07\/R_blogger_logo_02.png","width":"1061","height":"304"},"name":"R-bloggers"},"inLanguage":"en-US","description":" Answers to the exercises are available here. Exercise 1 Consider two vectors, x, y x=c(4,6,5,7,10,9,4,15) y=c(0,10,1,8,2,3,4,1) What is the value of: x*y Exercise 2 Consider two vectors, a, b a=c(1,2,4,5,6) b=c(3,2,4,1,9) What is the value of: cbind(a,b) Exercise ","primaryImageOfPage":{"@id":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/#primaryimage"},"mainContentOfPage":[[{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"Home","url":"https:\/\/www.r-bloggers.com"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"About","url":"http:\/\/www.r-bloggers.com\/about\/"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"RSS","url":"https:\/\/feeds.feedburner.com\/RBloggers"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"add your blog!","url":"http:\/\/www.r-bloggers.com\/add-your-blog\/"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"Learn R","url":"https:\/\/www.r-bloggers.com\/how-to-learn-r-2\/"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"R jobs","url":"https:\/\/www.r-users.com\/"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"Submit a new job (it's free)","url":"https:\/\/www.r-users.com\/submit-job\/"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"Browse latest jobs (also free)","url":"https:\/\/www.r-users.com\/"},{"@context":"https:\/\/schema.org","@type":"SiteNavigationElement","@id":"https:\/\/www.r-bloggers.com\/#top nav","name":"Contact us","url":"http:\/\/www.r-bloggers.com\/contact-us\/"}]]},{"@type":"Article","@id":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/#article","url":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/","inLanguage":"en-US","mainEntityOfPage":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/#webpage","headline":"Vectors Vol. 2 Exercises | R-bloggers","description":" Answers to the exercises are available here. Exercise 1 Consider two vectors, x, y x=c(4,6,5,7,10,9,4,15) y=c(0,10,1,8,2,3,4,1) What is the value of: x*y Exercise 2 Consider two vectors, a, b a=c(1,2,4,5,6) b=c(3,2,4,1,9) What is the value of: cbind(a,b) Exercise ","articleBody":" Answers to the exercises are available here. Exercise 1 Consider two vectors, x, y xc(4,6,5,7,10,9,4,15) yc(0,10,1,8,2,3,4,1) What is the value of: x*y Exercise 2 Consider two vectors, a, b ac(1,2,4,5,6) bc(3,2,4,1,9) What is the value of: cbind(a,b) Exercise 3 Consider two vectors, a, b ac(1,5,4,3,6) bc(3,5,2,1,9) What is the value of: a&lt;b Exercise 4 Consider two vectors, a, b ac(10,2,4,15) bc(3,12,4,11) What is the value of: rbind(a,b) Exercise 5 If xc(1:12) What is the value of: dim(x) What is the value of: length(x) Exercise 6 If ac(12:5) What is the value of: is.numeric(a) Exercise 7 Consider two vectors, x, y xc(12:4) yc(0,1,2,0,1,2,0,1,2) What is the value of: which(!is.finite(x\/y)) Exercise 8 Consider two vectors, x, y xletters yletters What is the value of: x&lt;y Exercise 9 If xc('blue','red','green','yellow') What is the value of: is.character(x) Exercise 10 If xc('blue',10,'green',20) What is the value of: is.character(x) Want to practice vectors a bit more? We have more exercise sets on this topic here.","keywords":"","datePublished":"2016-11-15T11:00:16-06:00","dateModified":"2016-11-15T11:00:16-06:00","author":{"@type":"Person","name":"Maria Elisa Bertinat Tulipano","description":"","url":"https:\/\/www.r-bloggers.com\/author\/maria-elisa-bertinat-tulipano\/","sameAs":["http:\/\/r-exercises.com"],"image":{"@type":"ImageObject","url":"https:\/\/secure.gravatar.com\/avatar\/7896378bf6150cd6f388409211585f23?s=96&d=mm&r=g","height":96,"width":96}},"publisher":{"@id":"https:\/\/www.r-bloggers.com#Organization"},"image":[{"@type":"ImageObject","url":"http:\/\/r-exercises.com\/wp-content\/uploads\/2015\/10\/cooltext150717148122234.png?x61433","width":0,"height":0,"@id":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/#primaryimage"}],"isPartOf":{"@id":"https:\/\/www.r-bloggers.com\/vectors-vol-2-exercises\/#webpage"}}]}] var snp_f = []; var snp_hostname = new RegExp(location.host); var snp_http = new RegExp("^(http|https)://", "i"); var snp_cookie_prefix = ''; var snp_separate_cookies = false; var snp_ajax_url = 'https://www.r-bloggers.com/wp-admin/admin-ajax.php'; var snp_ajax_nonce = 'e59a04e478'; var snp_ignore_cookies = false; var snp_enable_analytics_events = false; var snp_enable_mobile = false; var snp_use_in_all = false; var snp_excluded_urls = []; snp_excluded_urls.push(''); Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts. (You will not see this message again.) Click here to close (This popup will not appear again).snp-pop-109583 .snp-theme6 { max-width: 700px;} .snp-pop-109583 .snp-theme6 h1 {font-size: 17px;} .snp-pop-109583 .snp-theme6 { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field ::-webkit-input-placeholder { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field :-moz-placeholder { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field :-ms-input-placeholder { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field input { border: 1px solid #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field { color: #000000;} .snp-pop-109583 .snp-theme6 { background: #f2f2f2;}jQuery(document).ready(function() { }); var CaptchaCallback = function() { jQuery('.g-recaptcha').each(function(index, el) { grecaptcha.render(el, { 'sitekey' : '' }); }); }; window.FPConfig= { delay: 0, ignoreKeywords: ["\/wp-admin","\/wp-login.php","\/cart","add-to-cart","logout","#","?",".png",".jpeg",".jpg",".gif",".svg"], maxRPS: 3, hoverDelay: 50 }; _stq = window._stq || []; _stq.push([ 'view', {v:'ext',j:'1:7.3.2',blog:'11524731',post:'143004',tz:'-6',srv:'www.r-bloggers.com'} ]); _stq.push([ 'clickTrackerInit', '11524731', '143004' ]); jQuery(document).ready(function (\$) { //\$( document ).ajaxStart(function() { //}); for (var i = 0; i < document.forms.length; ++i) { var form = document.forms[i]; if (\$(form).attr("method") != "get") { \$(form).append('<input type="hidden" name="iLk_OoNZATdV" value="W84S_c1w*Ka7" />'); } if (\$(form).attr("method") != "get") { \$(form).append('<input type="hidden" name="pYbxk_z" value="0eJkL7w" />'); } if (\$(form).attr("method") != "get") { \$(form).append('<input type="hidden" name="xXGyZbrfKpq" value="gGW7HJCYOhl" />'); } } \$(document).on('submit', 'form', function () { if (\$(this).attr("method") != "get") { \$(this).append('<input type="hidden" name="iLk_OoNZATdV" value="W84S_c1w*Ka7" />'); } if (\$(this).attr("method") != "get") { \$(this).append('<input type="hidden" name="pYbxk_z" value="0eJkL7w" />'); } if (\$(this).attr("method") != "get") { \$(this).append('<input type="hidden" name="xXGyZbrfKpq" value="gGW7HJCYOhl" />'); } return true; }); jQuery.ajaxSetup({ beforeSend: function (e, data) { //console.log(Object.getOwnPropertyNames(data).sort()); //console.log(data.type); if (data.type !== 'POST') return; if (typeof data.data === 'object' && data.data !== null) { data.data.append("iLk_OoNZATdV", "W84S_c1w*Ka7"); data.data.append("pYbxk_z", "0eJkL7w"); data.data.append("xXGyZbrfKpq", "gGW7HJCYOhl"); } else { data.data = data.data + '&iLk_OoNZATdV=W84S_c1w*Ka7&pYbxk_z=0eJkL7w&xXGyZbrfKpq=gGW7HJCYOhl'; } } }); }); ```