Use of and operators in R

0 votes
A little bit of trouble getting hold of what are the $ and %% terms.

As I understand I can use the $ term to pull a certain value from a function (e.g. t.test(x)$p.value), but I'm not sure if this is a universal definition. I also know it is possible to use this to specify to pull certain data.

I also want to know about the use of the %% term, in particular, if I am placing a value in between it (e.g. %x%) I am aware of using it as a modulator or remainder e.g. 7 %% 5 returns 2. Perhaps I am being ignorant and this is not real?
Jun 2, 2022 in Data Analytics by avinash
• 1,840 points
748 views

1 answer to this question.

0 votes
According to help('percent in percent'), percent in percent is a value matching function that "returns a vector of the places of (first) matches of its first parameter in its second." This implies that you might compare vectors of various lengths to determine whether at least one element in one vector matches an element in another. The output will have a length equal to the vector being compared (the first one).

1:2 in percentage return (1:2,5)
#[1] True, True

Replicate (1:2,5) in percent 1:2 #[1] True, True, True, True, True, True, True

The output is longer in seconds; take note.
If two things are exactly equal, the comparison operator == is used. The elements of the vectors will be compared element-by-element if they are similar in length. Vectors will be recycled if not. The output's length
answered Jun 23, 2022 by Sohail
• 3,040 points

Related Questions In Data Analytics

+1 vote
2 answers

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
82,288 views
0 votes
1 answer

How to forecast season and trend of data using STL and ARIMA in R?

You can use the forecast.stl function for the ...READ MORE

answered May 19, 2018 in Data Analytics by DataKing99
• 8,250 points
2,172 views
0 votes
2 answers

What is the difference between %% and % in R programming?

HI, %% returns remainder in case of numeric ...READ MORE

answered Aug 26, 2019 in Data Analytics by anonymous
• 33,030 points
2,407 views
0 votes
1 answer
0 votes
1 answer

Difference between the == and %in% operators in R

percent in percent "returns a vector of ...READ MORE

answered Jun 20, 2022 in Data Science by Sohail
• 3,040 points
724 views
0 votes
1 answer

Difference between the == and %in% operators in R

According to help('percent in percent'), percent in ...READ MORE

answered Jun 23, 2022 in Data Science by Sohail
• 3,040 points
497 views
0 votes
1 answer

How to make loop for one-at-a time logistic regression in R?

You're probably looking for something similar to ...READ MORE

answered Jun 20, 2022 in Data Science by Sohail
• 3,040 points
1,037 views
0 votes
1 answer

How to use Aggregate function in R

Where dat is the name of your ...READ MORE

answered Jun 24, 2022 in Data Analytics by Sohail
• 3,040 points
594 views
0 votes
1 answer

How to use the switch statement in R functions?

Switch definitely wasn't intended to operate this ...READ MORE

answered Jun 24, 2022 in Data Analytics by Sohail
• 3,040 points
589 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP