RStudio and Integer vector Difference
Is there an open thread about calculations in RStudio? If not, here is my very simple question. Consider:
vector_a <- (-5:5)
and
vector_b <- (0:10)
I have to calculate the difference/sum/product between values in vector_a and values in vector_b.
Sum <- sum(vector_a, vector_b) returns value 55.
But product and difference functions return strange results.
If I use the command:
Difference <- vector_a - vector_b
this returns values 1, 1, 1, 1,1,..
When I use the command:
Difference <- diff(vector_a, vector_b)
returns error!
Does anybody can explain what are the right commands for these basic calculations?, Thanks for your help.
• 624 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello Asia Alterego!
We believe that this post does not fit the main topic of this site.
This is a pure R question, unrelated explicitly to bioinformatics, and is better suited to, e.g. StackOverflow
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!