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
Cluster sampling, Cluster Sampling Here the population is divide...
Cluster Sampling Here the population is divided into clusters or groups and then Random Sampling is done for each cluster. Cluster Sampling differs from Stratified Sampl
Compute the sample mean and sample standard deviation, We want to investiga...
We want to investigate the income data. In the Excel file Midterm Data.xls there is a tab labeled "Income Data 2006". The data in the tab is the income reported by 400 people in
Primary and secondary data, Primary and Secondary Data: Primary Data: ...
Primary and Secondary Data: Primary Data: These data are those are collected for the first time. Thus primary data are original in character and gathered by actual observat
Show the hypothesis test, The file Midterm Data.xls has a tab labeled "Inc...
The file Midterm Data.xls has a tab labeled "Income Data 2009". This data is collected income data from a sample of 400 people in 2009. Use a hypothesis test to see whether the av
Evaluate expressions, I need help
I need help
Correlation coefficient, Consider three stocks A, B and C costing $100 each...
Consider three stocks A, B and C costing $100 each. The annual returns on the three stocks have mean $5 and variance $10. a. Suppose that the returns on the three stocks are i.i
Sampling theory, difference between large sample test and small sample test...
difference between large sample test and small sample test
Define the term multicollinearity, Question: (a) (i) Define the term ...
Question: (a) (i) Define the term multicollinearity. (ii) Explain why it is important to guard against multicollinearity. (b) (i) Sometimes we encounter missing values
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
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
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