Difference between revisions of "File:Monica.zip"

From Testiwiki
Jump to: navigation, search
(An example data from Monica study. {{study}} Category:Cardiovascular disease Category:Data Category:Finland)
 
(uploaded a new version of "File:Monica.zip": Some decodings and transformations applied.)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
An example data from [[Monica]] study.
 
{{study}}
 
 
[[Category:Cardiovascular disease]]
 
[[Category:Cardiovascular disease]]
 
[[Category:Data]]
 
[[Category:Data]]
 
[[Category:Finland]]
 
[[Category:Finland]]
 +
{{study}}
 +
 +
An example data from '''[[Monica]]''' study.
 +
 +
==Rationale==
 +
 +
An rcode for managing the [[Monica]] data into a more easily usable format. The produced csv file was then 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
 +
monica$height[monica$height==999] <- NA
 +
monica$weight[monica$weight==9999] <- NA
 +
monica$waist[monica$waist==9999] <- NA
 +
monica$hip[monica$hip==9999] <- NA
 +
monica$school[monica$school == 99] <- NA
 +
 +
#unit transformations
 +
monica$weight <- monica$weight/10 #transform to kg
 +
monica$waist <- monica$waist/10 #transform to cm
 +
monica$hip <- monica$hip/10 #transform to cm
 +
 +
write.csv(monica, "//cesium/jtue$/_Documents/Monica.csv")
 +
 +
# This csv file was then zipped and uploaded to [[:File:Monica.zip]]
 +
</pre>
 +
}}

Latest revision as of 17:47, 8 December 2013



An example data from Monica study.

Rationale

An rcode for managing the Monica data into a more easily usable format. The produced csv file was then converted to zip and uploaded to File:Monica.zip.


File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current17:47, 8 December 2013 (594 KB)Jouni (talk | contribs)Some decodings and transformations applied.
11:28, 8 December 2013 (590 KB)Jouni (talk | contribs)An example data from Monica study. {{study}} Category:Cardiovascular disease Category:Data Category:Finland
  • You cannot overwrite this file.

There are no pages that link to this file.