Question

I'm using the programming language R. Can someone please tell me why this returns true? a1=c(5,"7",9,12,"15")...

I'm using the programming language R. Can someone please tell me why this returns true?

a1=c(5,"7",9,12,"15")
a2=c(5,7,9,12,15)

a1 == a2

Output is:

> a1 == a2
[1] TRUE TRUE TRUE TRUE TRUE

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a1=c(5,"7",9,12,"15")

Here all are considered as characters so the characters are 5 7 9 12 15 irrespective of quotation.

a2=c(5,7,9,12,15)

Here the characters are 5 7 9 12 15

a1 == a2

Here we are compare every character of a1 with a2

5 == 5 ---------->TRUE

7 == 7 ---------->TRUE

9 == 9 ---------->TRUE

12 == 12 ------->TRUE

15 == 15 ------->TRUE

So it print as

a1 == a2
[1] TRUE TRUE TRUE TRUE TRUE

Add a comment
Know the answer?
Add Answer to:
I'm using the programming language R. Can someone please tell me why this returns true? a1=c(5,"7",9,12,"15")...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Could someone please help me with this C language code I'm confused as to why i'm...

    Could someone please help me with this C language code I'm confused as to why i'm getting an error every time I run it on command line if some could please help me as soon as possible. #include <stdio.h> #include <stdlib.h> int main() { char *ptr_two = (char *)malloc(sizeof(char)*50); printf("%p\n", ptr_two); ptr_two = "A constant string in C"; printf("%p\n", ptr_two); printf("%s\n", ptr_two); free(ptr_two); return 0; }

  • can someone assist me and tell me what I'm missing. I managed to get it this...

    can someone assist me and tell me what I'm missing. I managed to get it this far but still missing two parts to complete it. CENGAGE MINDTAP Programming Exercise 6-4 Tasks main.cpp + 1 #include <iostream r with successful Uses piand 2 #include <cnath> output 5,00 out of 10.00 3 using nanespace std; 4 5 const double PI = 3.1419; 2 out of 4 checks passed. Review 6 the results below for more details. 7 int main() 8 ( Checks...

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

  • PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE...

    PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE C AS A PROGRAMMING LANGUAGE 11. Initialize a integers in the two-dimensional array testArray to the values 1 through 9 using 1 or more while loops so that the array could be visualized as: 1 2 3 LA 5 6 7 8 9...

  • C Programming Can someone please explain me while the following (c) code prints out 6? for...

    C Programming Can someone please explain me while the following (c) code prints out 6? for (i=1; x<=5; i++); printf ("%d",i); i=1 initializes the the loop, it is being tested whether it is <= 5 or not. This statement is true, so it goes into the loop and prints 1. After that, i++, means 1+1=2, i=2. This statement is being tested and it is true, we go into the loop and print 2. Then i=3, true, loop prints 3 -->...

  • Can someone help me with this, and it has to be written in the C programming...

    Can someone help me with this, and it has to be written in the C programming language: Write a program that reads a string from the keyboard. If the length of the string is an even number, your program should split the string into two strings of equal length. If the length of the string is odd, your program should split the string into two strings where the first part has one more character than the second part. Your program...

  • please can you help me with this problem in C programminig language C 6.33 LAB: Max...

    please can you help me with this problem in C programminig language C 6.33 LAB: Max And Min Number: x + m/zybook/NORMANDALECSC11111BenekeSpring2020/chapter/3/section/21 SCI 1111: Programming in C home > 3.21: LAB: Smallest number 3.21 LAB: Smallest number Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is:

  • Please Use R programming language to answers these question and please show me the code as...

    Please Use R programming language to answers these question and please show me the code as well. Thank You 1. Problem: dataset: savings; package : faraway Use R, perform the calculations and answer the following questions (a) Calculate the design matrix X, and all regression coefficients estimates, as shown in (3). (b) Calculate the Residuals standard error , as in (5). (c) ANOVA table: Calculate SST, SSE, SSR, ?2, as in (6).      Calculate the ANOVA F-statistic and p-value. (d)...

  • Please complete these C programming questions. Thanks you kindly True/False 1. C is a programming language...

    Please complete these C programming questions. Thanks you kindly True/False 1. C is a programming language 2. C is used only in academic settings 3. C syntax is based on Python 4. C in the acronym ASCII refers to the C language 5, C is a valid name for a variable name 6. C is the character result of 'B' +1

  • Can someone please tell me why this is suddenly is an addition (indicated by the blue...

    Can someone please tell me why this is suddenly is an addition (indicated by the blue arrow) when the formula has a subtraction here. Thanks in advance!! Exercise 25.2 The reaction 2 NO2(g) ? 2 NO(g) + O2(g) has a rate constant of k= 0.522 M-1 s-1 at 592 K, and a rate constant of k = 1.70 M-1 s-1 at 627 K. (a) Calculate Ea for the reaction, giving your answer in kJ mol-1. mal

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT