
Convert R code to javascript
- or -
Post a project like this£250(approx. $323)
- Posted:
- Proposals: 5
- Remote
- #1212818
- PRE-FUNDED
- Expired
Description
Experience Level: Expert
Estimated project duration: less than 1 week
General information for the business: Data work
Description of requirements/functionality: This side has R code for analyzing a survey:
https://github.com/ajdamico/asdfree/blob/master/Youth%20Risk%20Behavior%20Surveillance%20System/replicate%20cdc%20software%20for%20analysis%20of%20yrbs%20data%20publication.R#L73-L91
You can look in the attached file for the R source code for the survey package. You'll see it's the svymean and s
I need the relevant pieces converted to pure javascript. Or offer a bounty if someone finds it out there. :)
Specifically, I need the below R code replaced with JavaScript (see the link above):
library(survey) # load survey package (analyzes complex design surveys)
#################################################
68 # survey design for taylor-series linearization #
69 #################################################
70
71 # create taylor-series linearization survey design object
72 # with YRBSS design information using the data frame `x`
73 y <-
74 svydesign(
75 ~psu ,
76 strata = ~stratum ,
77 data = x ,
78 weights = ~weight ,
79 nest = TRUE
80 )
81
82
83 # the above complex sample survey design object `y` can be used to
84 # precisely replicate SUDAAN's coefficients and standard errors
85
86 # for each of the three survey questions, both print the results of
87 # the `svymean` call to the screen - by encapsulating the statement in ( )
88 # and also save it into some separate object that can be queried later
89 ( helmet <- svymean( ~as.numeric( qn8 == 1 ) , y , na.rm = TRUE ) )
This outputs:
mean SE
as.numeric(qn8 == 1) 0.87873 0.0129
Which matches the valid output that you can see here:
https://nccd.cdc.gov/youthonline/App/Results.aspx?TT=B&OUT=0&SID=HS&QID=H8&LID=LL&YID=2013&LID2=&YID2=&COL=S&ROW1=N&ROW2=N&HT=QQ&LCT=LL&FS=S1&FR=R1&FG=G1&FSL=S1&FRL=R1&FGL=G1&PV=&TST=False&C1=&C2=&QP=G&DP=2&VA=St&CS=Y&SYID=&EYID=&SC=DEFAULT&SO=ASC
You can use the methods and getAnywhere R functions to see the R source. (open source)
I will retain all rights to the code (which I will eventually open source).
I need this within a few days. Around July 13th.
Extra notes:
I attached the R source code for the survey package. It's the svymean and svydesign functions, as well as called functions and data structures, that need to be ported to pure javascript. Bonus if you can get this done this weekend.
Description of requirements/functionality: This side has R code for analyzing a survey:
https://github.com/ajdamico/asdfree/blob/master/Youth%20Risk%20Behavior%20Surveillance%20System/replicate%20cdc%20software%20for%20analysis%20of%20yrbs%20data%20publication.R#L73-L91
You can look in the attached file for the R source code for the survey package. You'll see it's the svymean and s
I need the relevant pieces converted to pure javascript. Or offer a bounty if someone finds it out there. :)
Specifically, I need the below R code replaced with JavaScript (see the link above):
library(survey) # load survey package (analyzes complex design surveys)
#################################################
68 # survey design for taylor-series linearization #
69 #################################################
70
71 # create taylor-series linearization survey design object
72 # with YRBSS design information using the data frame `x`
73 y <-
74 svydesign(
75 ~psu ,
76 strata = ~stratum ,
77 data = x ,
78 weights = ~weight ,
79 nest = TRUE
80 )
81
82
83 # the above complex sample survey design object `y` can be used to
84 # precisely replicate SUDAAN's coefficients and standard errors
85
86 # for each of the three survey questions, both print the results of
87 # the `svymean` call to the screen - by encapsulating the statement in ( )
88 # and also save it into some separate object that can be queried later
89 ( helmet <- svymean( ~as.numeric( qn8 == 1 ) , y , na.rm = TRUE ) )
This outputs:
mean SE
as.numeric(qn8 == 1) 0.87873 0.0129
Which matches the valid output that you can see here:
https://nccd.cdc.gov/youthonline/App/Results.aspx?TT=B&OUT=0&SID=HS&QID=H8&LID=LL&YID=2013&LID2=&YID2=&COL=S&ROW1=N&ROW2=N&HT=QQ&LCT=LL&FS=S1&FR=R1&FG=G1&FSL=S1&FRL=R1&FGL=G1&PV=&TST=False&C1=&C2=&QP=G&DP=2&VA=St&CS=Y&SYID=&EYID=&SC=DEFAULT&SO=ASC
You can use the methods and getAnywhere R functions to see the R source. (open source)
I will retain all rights to the code (which I will eventually open source).
I need this within a few days. Around July 13th.
Extra notes:
I attached the R source code for the survey package. It's the svymean and svydesign functions, as well as called functions and data structures, that need to be ported to pure javascript. Bonus if you can get this done this weekend.

Herschel C.
100% (58)Projects Completed
54
Freelancers worked with
46
Projects awarded
42%
Last project
22 Nov 2023
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies