Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

• # How to create an apply function with the dataset and function below in R?

• 0
• 0
• 0
• 0
• 0
• 0
• 0
• 311

I have this function:

xa <- 9

xb <- 6

za <- 20

a1 <- xa / za

b1 <- xb / za

Validation <- function (a1, b1)

if (a1 / b1 >= .85 && a1 / b1 <= 1.15) {print(TRUE)}

result <- Validation (a1, b1)

result

The value of xa, xb, and za change ten times and there are also three other trios of data that change ten times:

c1 <- xc / zc

d1 <- xd / zc

e1 <- xe / ze

f1 <- xf / ze

g1 <- xg / zg

h1 <- xh / zg

as you can see in the dataframe below:

mat <- data.frame(xa = sample(0:10,  10, replace = TRUE),

xb = sample(0:10,  10, replace = TRUE),

za = sample(10:20, 10, replace = TRUE),

xc = sample(0:10,  10, replace = TRUE),

xd = sample(0:10,  10, replace = TRUE),

zc = sample(10:20, 10, replace = TRUE),

xe = sample(0:10,  10, replace = TRUE),

xf = sample(0:10,  10, replace = TRUE),

ze = sample(10:20, 10, replace = TRUE),

xg = sample(0:10,  10, replace = TRUE),

xh = sample(0:10,  10, replace = TRUE),

zg = sample(10:20, 10, replace = TRUE))

mat

So, my question is: How can I create a function that also considers these three other trios of data and run the 'if' function for the ten lines of the dataframe?

I ultimately want to have an output of ten lines and four columns (za, zc, ze, zg) with the information: TRUE or NULL.

Thanks,

OR
OR
Register

OR
Fill out the form below and instructions to reset your password will be emailed to you:

• Hire
• Post Projects

### Post Projects

• All at 0 Cost ....
• Post Tech Job
• Select Best Bidder
• Track the Project
• Approve Work and Pay safely
• Browse Nerds
• Work
• Find Projects Find Projects
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...
• Manage
• Company Company

### Manage Company

• All at 0 Cost ....
• Manage Company and Employee Profiles
• Company wide Employee Productivity Reports
• Knowledge Sharing and Collaboration Tools
• Get Sales Lead and Bid for Tech Projects
• Send Invoices and Receive Payment Safely
• Learn
• Nerd Digest Nerd Digest
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...
• Tech Q & A Tech Q & A
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...