Login

Create Account
Customer Service Chat
+14156709189
info@expertsmind.com
Submit Homework/Assignment
Get quote & make Payment
Get Solution
Question with R  Bioinformatics, Applied Statistics
Hi There,
I have a question regarding R, and I am wondering if anyone can help me.
Here is a code that I would like to understand:
squareFunc < function(f) {
g < function(x) {
f(x)^2
}
return(g)
}
sin.2 < squareFunc(sin)
sin.2(1)
In the above code, function sin is nested in suquareFunc, which also has a function g inside.
I am having hard time understanding this code.
For example, if I was asked to write this code, mine would look like:
squareFunc < function(f) {
g < f^2
return(g)
}
sin.2 < squareFunc(sin)
sin.2(1)
and this does not work.
I feel that argument ''f'' in in squareFunc(f) should be passed on to the function ''g'', but what g has is (x).
Obviously the first code works if I type it in R, but I would like to understand how it works.
I may not be asking the right question, but if you can see where I am confused at and can help me to understand it, that would be great.
Thank you very much in advance.
Mayumi
Posted Date: 1/20/2013 8:46:28 PM  Location : Canada
Ask an Expert
Related Discussions:
Question with R  Bioinformatics, Assignment Help, Ask Question on Question with R  Bioinformatics, Get Answer, Expert's Help, Question with R  Bioinformatics Discussions
Write discussion on Question with R  Bioinformatics
Your posts are moderated
Write your message here..
Related Questions
Expected utility maximizer, The investor has constant wealth 1 and is o?ere...
The investor has constant wealth 1 and is o?ered to invest in shares of a project that either gains 3=2 or loses 1 with equal probabilities. Therefore, if the investor obtains sha
Canonical correlation analysis, Canonical correlation analysis (CC) allows ...
Canonical correlation analysis (CC) allows the investigation of the relationship between two ,sets of variables. For example, a sociologist may want to investigate the Relationship
Confidence interval, a) List down several measures of central tendency and ...
a) List down several measures of central tendency and define the difference among them? b) What do you mean by confidence interval, and why it is useful? What is a confidence lev
Modelling and prediction of performance, case study in heat power engineeri...
case study in heat power engineering
Semiaverages and least square, how can we graph a trend line by semiaverage...
how can we graph a trend line by semiaverages and least square method?
Bernoulli trial, Statistician is searching the \home ground" effect and is ...
Statistician is searching the \home ground" effect and is studying 20 football games, of which 14 were won by the home team and 6 by the visitors. Therefore the game is a Bernoulli
What are the null and alternative hypotheses, Test the following claim. Id...
Test the following claim. Identify the null hypothesis, alternative hypothesis, test statistic, critical value(s), conclusion about the null hypothesis, and final conclusion that
Estimation, what do we mean by critical region
what do we mean by critical region
Find the unbiased estimators for mean and variance matrix, Is the random ve...
Is the random vector (Trunk Space, Length, Turning diameter) of US car normally distributed? Why? If yes, find the unbiased estimators for the mean and variance matrix of (Trunk Sp
Diversity of data for the age, The box plot displays the diversity of data ...
The box plot displays the diversity of data for the age; the data ranges from 19 being the minimum value and 60 being the maximum value. The box plot is positively skewed at 0.57 a
Assignment Help
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
ExpertsMind Services
Online Tutoring
Projects Assistance
Exam Preparation
Coursework Help
Programming Help
IT Services
Why Us ?
~Experienced Tutors
~24x7 hrs Support
~Plagiarism Free
~Quality of Work
~Time on Delivery
~Privacy of Work