Hello Everyone,
Is there any way to take a NONMEM FDATA file and convert it into a typical .csv
file?
Thanks,
Justus
FDATA
3 messages
3 people
Latest: Apr 24, 2012
Justus,
You could try this. Change NMAX to the number of records that FDATA uses for each individual. The example below shows 2 records in FDATA for each individual.
gawk can be downloaded here http://www.klabaster.com/freeware.htm#mawk
Nick
======= FDATA ======
1 1 1 1 1
1 1 1 1 1
2 2 2 2 2
2 2 2 2 2
3 3 3 3 3
3 3 3 3 3
======= Command line (any OS that supports gawk) =====
gawk -f fdata2csv.awk -v NMAX=3 FDATA>fdata.csv
====== fdata2csv.awk =======
BEGIN {
nrec=0
rec=""
}
{
if (nrec==NMAX) { printrec(); nrec=0; rec="" }
nrec++
rec=rec " " $0
}
END {
printrec()
}
function printrec() {
nitem=split(rec,ITEMS)
outrec=""
for (i=1; i<nitem; i++) {
outrec=outrec sprintf("%s,",ITEMS[i])
}
print outrec sprintf("%s",ITEMS[nitem])
}
Quoted reply history
On 18/04/2012 11:43 p.m., Justus Bingham wrote:
> Hello Everyone,
>
> Is there any way to take a NONMEM FDATA file and convert it into a typical .csv
> file?
>
> Thanks,
>
> Justus
--
Nick Holford, Professor Clinical Pharmacology
First World Conference on Pharmacometrics, 5-7 September 2012
Seoul, Korea http://www.go-wcop.org
Dept Pharmacology& Clinical Pharmacology, Bldg 505 Room 202D
University of Auckland,85 Park Rd,Private Bag 92019,Auckland,New Zealand
tel:+64(9)923-6730 fax:+64(9)373-7090 mobile:+64(21)46 23 53
email: [email protected]
http://www.fmhs.auckland.ac.nz/sms/pharmacology/holford
Alternatively, import the file into Excel (or the spreadsheet clone of your
choice). Then "save as" a .csv file.
Quoted reply history
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Nick Holford
Sent: Thursday, April 19, 2012 4:39 AM
To: nmusers
Subject: Re: [NMusers] FDATA
Justus,
You could try this. Change NMAX to the number of records that FDATA uses
for each individual. The example below shows 2 records in FDATA for each
individual.
gawk can be downloaded here http://www.klabaster.com/freeware.htm#mawk
Nick
======= FDATA ======
1 1 1 1 1
1 1 1 1 1
2 2 2 2 2
2 2 2 2 2
3 3 3 3 3
3 3 3 3 3
======= Command line (any OS that supports gawk) =====
gawk -f fdata2csv.awk -v NMAX=3 FDATA>fdata.csv
====== fdata2csv.awk =======
BEGIN {
nrec=0
rec=""
}
{
if (nrec==NMAX) { printrec(); nrec=0; rec="" }
nrec++
rec=rec " " $0
}
END {
printrec()
}
function printrec() {
nitem=split(rec,ITEMS)
outrec=""
for (i=1; i<nitem; i++) {
outrec=outrec sprintf("%s,",ITEMS[i])
}
print outrec sprintf("%s",ITEMS[nitem])
}
On 18/04/2012 11:43 p.m., Justus Bingham wrote:
> Hello Everyone,
>
> Is there any way to take a NONMEM FDATA file and convert it into a typical
> .csv file?
>
> Thanks,
>
> Justus
--
Nick Holford, Professor Clinical Pharmacology
First World Conference on Pharmacometrics, 5-7 September 2012
Seoul, Korea http://www.go-wcop.org
Dept Pharmacology& Clinical Pharmacology, Bldg 505 Room 202D
University of Auckland,85 Park Rd,Private Bag 92019,Auckland,New Zealand
tel:+64(9)923-6730 fax:+64(9)373-7090 mobile:+64(21)46 23 53
email: [email protected]
http://www.fmhs.auckland.ac.nz/sms/pharmacology/holford