Monica: Difference between revisions
(placeholder) |
(→Answer) |
||
Line 13: | Line 13: | ||
* [http://www.thl.fi/monica/ Project homepage] | * [http://www.thl.fi/monica/ Project homepage] | ||
* [http://www.thl.fi/publications/monica/monograph_cd/data/form04_3.zip Monica data] | * [http://www.thl.fi/publications/monica/monograph_cd/data/form04_3.zip Monica data] | ||
* [[:File:Monica.zip]] | |||
** The data documentation can be found at [http://www.thl.fi/publications/monica/monograph_cd/formats/form048.htm] [http://www.thl.fi/publications/monica/monograph_cd/formats/survey.htm] [http://www.thl.fi/monica/public/datacomp.html] | ** The data documentation can be found at [http://www.thl.fi/publications/monica/monograph_cd/formats/form048.htm] [http://www.thl.fi/publications/monica/monograph_cd/formats/survey.htm] [http://www.thl.fi/monica/public/datacomp.html] | ||
==Rationale== | |||
An rcode for managing the data into a more easily usable format. The produced csv file was the converted to zip and uploaded to [[:File:Monica.zip]]. | |||
{{hidden| | |||
<pre> | |||
#File: http://www.tilastotiede.fi/ReplicaX/example_MONICA.r | |||
#Author: Juha Karvanen (juha.karvanen at iki.fi) | |||
# | |||
#Summary: This code demonstrates the creation of data replicas with ReplicaX R functions. | |||
#The R functions needed are available as http://www.tilastotiede.fi/ReplicaX/ReplicaX_functions.r | |||
#For information see http://www.tilastotiede.fi/ReplicaX/ReplicaX_esitys.pdf (in Finnish) | |||
# | |||
#The data used is a published sample of WHO MONICA data. | |||
#Before running the code, you should download the data from | |||
#http://www.thl.fi/publications/monica/monograph_cd/data/form04_3.zip | |||
# | |||
#The data documentation can be found at | |||
#http://www.thl.fi/publications/monica/monograph_cd/formats/form048.htm | |||
#http://www.thl.fi/publications/monica/monograph_cd/formats/survey.htm | |||
# | |||
#For more information on the MONICA project see http://www.thl.fi/monica/ | |||
print("ReplicaX demonstration with the MONICA data. Running the code takes a couple minutes.") | |||
#rm(list=ls()) | |||
set.seed(20131103) #to reproduce the results | |||
#path <- "/home/jutakarv/Documents/replica_gen/" | |||
#path <- "/home/q/tiede/replica_gen/" | |||
#path <- paste(getwd(),"/",sep="") | |||
#source(paste(path,"ReplicaX_functions.r",sep="")) | |||
path <- "//cesium/jtue$/_Downloads/form04_3/" # This was the temporary file on my own computer when doing the conversion. | |||
if(!file.exists(paste(path,"form04_3.txt",sep=""))) | |||
{ | |||
stop("Data file form04_3.txt does not exist in the current path. | |||
Please download it from http://www.thl.fi/publications/monica/monograph_cd/data/form04_3.zip | |||
or change the path definition") | |||
} | |||
widths <- c( | |||
2,1,2,2,6,1,3,8,8,1,1,1,1,2,1,3,1,1,4,1,3,2,1,3,1,3,2,1,1,1,1,1,1,1,1,1,2,1,1,3,3,2,3,3,2,1,2,2,4,2,3,3,8,3,3,8,3,4,2,3,4, | |||
4,4,2,1,2,1,1,1,1,1,4,4,4,4 | |||
) | |||
colnames <- c( | |||
"form","versn","centre","runit","serial","numsur","samunit","dexam","mbirth","agegr","sex","marit","edlevel", | |||
"school","cigs","numcigs","daycigs","evercig","stop","iflyear","maxcigs","cigage","cigarsm","cigar","pipesm","pipe", | |||
"othersm","hibp","drugs","bprecd","hich","chdt","chrx","chrecd","asp","menop","agem","horm","pill","syst1", | |||
"diast1","rz1","syst2","diast2","rz2","cuff","arm","bpcoder","timebp","rtemp","chol","choldl","dchol","hdl", | |||
"hdldl","dhdl","scn","cotin","carbmon","height","weight","waist","hip","whcoder","oversion","eage","eageg", | |||
"cohort1","cohort2","edtert1","edtert2","systm","diastm","chola","hdla" | |||
) | |||
monica <- read.fwf(file=paste(path,"form04_3.txt",sep=""),widths=widths,col.names=colnames) | |||
selectedcolnames <- c("marit","edlevel","school","height","weight","waist","hip") | |||
monica2 <- monica[,selectedcolnames] | |||
vartype <- c("discrete","discrete","discrete","continuous","continuous","continuous","continuous") | |||
#decoding missing values | |||
monica2$height[monica2$height==999] <- NA | |||
monica2$weight[monica2$weight==9999] <- NA | |||
monica2$waist[monica2$waist==9999] <- NA | |||
monica2$hip[monica2$hip==9999] <- NA | |||
monica2$school[monica2$school == 99] <- NA | |||
#unit transformations | |||
monica2$weight <- monica2$weight/10 #transform to kg | |||
monica2$waist <- monica2$waist/10 #transform to cm | |||
monica2$hip <- monica2$hip/10 #transform to cm | |||
write.csv(monica, "//cesium/jtue$/_Documents/Monica.csv") | |||
# This csv file was than zipped and uploaded to [[:File:Monica.zip]] | |||
</pre> | |||
}} | |||
==See also== | ==See also== |
Revision as of 11:34, 8 December 2013
This page is a study.
The page identifier is Op_en6247 |
---|
Moderator:Jouni (see all) |
|
Upload data
|
The MONICA (Multinational MONItoring of trends and determinants in CArdiovascular disease) Project was established in the early 1980s in many Centres around the world to monitor trends in cardiovascular diseases, and to relate these to risk factor changes in the population over a ten year period. It was set up to explain the diverse trends in cardiovascular disease mortality which were observed from the 1970s onwards. There were total of 32 MONICA Collaborating Centres in 21 countries. The total population age 25-64 years monitored was ten million men and women. The ten year data collection was completed in the late 1990s, and the main results were published in the following years. The data are still being used for analysis.
Question
What is the WHO Monica Study?
Answer
Rationale
An rcode for managing the data into a more easily usable format. The produced csv file was the converted to zip and uploaded to File:Monica.zip.
Show details |
---|
#File: http://www.tilastotiede.fi/ReplicaX/example_MONICA.r #Author: Juha Karvanen (juha.karvanen at iki.fi) # #Summary: This code demonstrates the creation of data replicas with ReplicaX R functions. #The R functions needed are available as http://www.tilastotiede.fi/ReplicaX/ReplicaX_functions.r #For information see http://www.tilastotiede.fi/ReplicaX/ReplicaX_esitys.pdf (in Finnish) # #The data used is a published sample of WHO MONICA data. #Before running the code, you should download the data from #http://www.thl.fi/publications/monica/monograph_cd/data/form04_3.zip # #The data documentation can be found at #http://www.thl.fi/publications/monica/monograph_cd/formats/form048.htm #http://www.thl.fi/publications/monica/monograph_cd/formats/survey.htm # #For more information on the MONICA project see http://www.thl.fi/monica/ print("ReplicaX demonstration with the MONICA data. Running the code takes a couple minutes.") #rm(list=ls()) set.seed(20131103) #to reproduce the results #path <- "/home/jutakarv/Documents/replica_gen/" #path <- "/home/q/tiede/replica_gen/" #path <- paste(getwd(),"/",sep="") #source(paste(path,"ReplicaX_functions.r",sep="")) path <- "//cesium/jtue$/_Downloads/form04_3/" # This was the temporary file on my own computer when doing the conversion. if(!file.exists(paste(path,"form04_3.txt",sep=""))) { stop("Data file form04_3.txt does not exist in the current path. Please download it from http://www.thl.fi/publications/monica/monograph_cd/data/form04_3.zip or change the path definition") } widths <- c( 2,1,2,2,6,1,3,8,8,1,1,1,1,2,1,3,1,1,4,1,3,2,1,3,1,3,2,1,1,1,1,1,1,1,1,1,2,1,1,3,3,2,3,3,2,1,2,2,4,2,3,3,8,3,3,8,3,4,2,3,4, 4,4,2,1,2,1,1,1,1,1,4,4,4,4 ) colnames <- c( "form","versn","centre","runit","serial","numsur","samunit","dexam","mbirth","agegr","sex","marit","edlevel", "school","cigs","numcigs","daycigs","evercig","stop","iflyear","maxcigs","cigage","cigarsm","cigar","pipesm","pipe", "othersm","hibp","drugs","bprecd","hich","chdt","chrx","chrecd","asp","menop","agem","horm","pill","syst1", "diast1","rz1","syst2","diast2","rz2","cuff","arm","bpcoder","timebp","rtemp","chol","choldl","dchol","hdl", "hdldl","dhdl","scn","cotin","carbmon","height","weight","waist","hip","whcoder","oversion","eage","eageg", "cohort1","cohort2","edtert1","edtert2","systm","diastm","chola","hdla" ) monica <- read.fwf(file=paste(path,"form04_3.txt",sep=""),widths=widths,col.names=colnames) selectedcolnames <- c("marit","edlevel","school","height","weight","waist","hip") monica2 <- monica[,selectedcolnames] vartype <- c("discrete","discrete","discrete","continuous","continuous","continuous","continuous") #decoding missing values monica2$height[monica2$height==999] <- NA monica2$weight[monica2$weight==9999] <- NA monica2$waist[monica2$waist==9999] <- NA monica2$hip[monica2$hip==9999] <- NA monica2$school[monica2$school == 99] <- NA #unit transformations monica2$weight <- monica2$weight/10 #transform to kg monica2$waist <- monica2$waist/10 #transform to cm monica2$hip <- monica2$hip/10 #transform to cm write.csv(monica, "//cesium/jtue$/_Documents/Monica.csv") # This csv file was than zipped and uploaded to [[:File:Monica.zip]] |