Re: [R] export R-data to VisIt

2007-10-19 Thread Bart Joosen
Thanks Katharine,

for the moment I'm not on a PC on which VisIt is installed, but it should do 
the trick.
By the way: to use 2 variables when creating the cdf file:
ncnew - create.ncdf(filename=file.cdf, vars = list(x1,x2))

That was one of the things that was working within the 2 hours ;-).

Thanks to Katharine and Peter for your time

Bart

- Original Message - 
From: Katharine Mullen [EMAIL PROTECTED]
To: Bart Joosen [EMAIL PROTECTED]
Cc: Peter Dalgaard [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, October 19, 2007 6:27 PM
Subject: Re: [R] export R-data to VisIt


Below is an example R - netCDF - R for rows of a dataframe that are
numeric vectors --note however that your dataframe includes character
vectors.  I can't look into that case at the moment - maybe it's easy to
solve, or maybe you have to do some hashing.

## begin ex.
library(ncdf)

dat - matrix(rnorm(20),10,2)

c1 - dim.def.ncdf( c1, c1units, 1:nrow(dat) )
c2 - dim.def.ncdf( c2, c2units, 1:nrow(dat) )

x1 - var.def.ncdf(name=v1, units=c1units,dim = c1, missval=0)
x2 - var.def.ncdf(name=v2, units=c2units,dim = c2, missval=0)

## for some reason, when vars is the vector c(x1,x2) this does't work
## it may be a bug; get around my adding other vars later
ncnew - create.ncdf(filename=file.cdf, vars = x1)
ncnew - var.add.ncdf(ncnew, x2)

put.var.ncdf(ncnew, v1, dat[,1])
put.var.ncdf(ncnew, v2, dat[,2])
close.ncdf(ncnew)

ofile - open.ncdf(file.cdf)

c_x1 - get.var.ncdf(ofile, v1)
c_x2 - get.var.ncdf(ofile, v2)

 Peter,

what a quick response!

But unfortunately, yes I tried the ncdf package, I looked at the examples,
but after 2 hours trying and many, many errors,  I gave up.

Bart
- Original Message -
From: Peter Dalgaard [EMAIL PROTECTED]
To: Bart Joosen [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, October 19, 2007 4:56 PM
Subject: Re: [R] export R-data to VisIt


Bart Joosen wrote:
 Hello,

 Is there anyone porting R data to VisIt (http://www.llnl.gov/visit/)?
 Altough VisIt accepts 5 dozen of data formats, I can't get my data into
 VisIt.

 I currently ran a simulation which gave me a data frame, which I wanted to
 import into VisIt to further explore the dataframe.

 Let's say I have a data frame as follows:

 dat - data.frame(cbind(  1,   1:10),X3= sample(LETTERS[1:3], 10,
 repl=TRUE))

 My currently data export is write.table(dat,C:/filename.csv)
 But I can't import this kind of data in Visit.
 An option is to export my dataframe as a .CDF file, but I couldn't get the
 right output of my dataframe with netcdf.

 So how do I put my dataframe in a netCDF format, or is there anyone who
 knows the easiest way to transport my data to VisIt?


Have you tried the ncdf package?


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@r-project.org mailing list

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] export R-data to VisIt

2007-10-19 Thread Katharine Mullen
Below is an example R - netCDF - R for rows of a dataframe that are
numeric vectors --note however that your dataframe includes character
vectors.  I can't look into that case at the moment - maybe it's easy to
solve, or maybe you have to do some hashing.

## begin ex.
library(ncdf)

dat - matrix(rnorm(20),10,2)

c1 - dim.def.ncdf( c1, c1units, 1:nrow(dat) )
c2 - dim.def.ncdf( c2, c2units, 1:nrow(dat) )

x1 - var.def.ncdf(name=v1, units=c1units,dim = c1, missval=0)
x2 - var.def.ncdf(name=v2, units=c2units,dim = c2, missval=0)

## for some reason, when vars is the vector c(x1,x2) this does't work
## it may be a bug; get around my adding other vars later
ncnew - create.ncdf(filename=file.cdf, vars = x1)
ncnew - var.add.ncdf(ncnew, x2)

put.var.ncdf(ncnew, v1, dat[,1])
put.var.ncdf(ncnew, v2, dat[,2])
close.ncdf(ncnew)

ofile - open.ncdf(file.cdf)

c_x1 - get.var.ncdf(ofile, v1)
c_x2 - get.var.ncdf(ofile, v2)

 Peter,

what a quick response!

But unfortunately, yes I tried the ncdf package, I looked at the examples,
but after 2 hours trying and many, many errors,  I gave up.

Bart
- Original Message -
From: Peter Dalgaard [EMAIL PROTECTED]
To: Bart Joosen [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, October 19, 2007 4:56 PM
Subject: Re: [R] export R-data to VisIt


Bart Joosen wrote:
 Hello,

 Is there anyone porting R data to VisIt (http://www.llnl.gov/visit/)?
 Altough VisIt accepts 5 dozen of data formats, I can't get my data into
 VisIt.

 I currently ran a simulation which gave me a data frame, which I wanted to
 import into VisIt to further explore the dataframe.

 Let's say I have a data frame as follows:

 dat - data.frame(cbind(  1,   1:10),X3= sample(LETTERS[1:3], 10,
 repl=TRUE))

 My currently data export is write.table(dat,C:/filename.csv)
 But I can't import this kind of data in Visit.
 An option is to export my dataframe as a .CDF file, but I couldn't get the
 right output of my dataframe with netcdf.

 So how do I put my dataframe in a netCDF format, or is there anyone who
 knows the easiest way to transport my data to VisIt?


Have you tried the ncdf package?


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] export R-data to VisIt

2007-10-19 Thread Bart Joosen
Peter,

what a quick response!

But unfortunately, yes I tried the ncdf package, I looked at the examples, 
but after 2 hours trying and many, many errors,  I gave up.

Bart
- Original Message - 
From: Peter Dalgaard [EMAIL PROTECTED]
To: Bart Joosen [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, October 19, 2007 4:56 PM
Subject: Re: [R] export R-data to VisIt


Bart Joosen wrote:
 Hello,

 Is there anyone porting R data to VisIt (http://www.llnl.gov/visit/)?
 Altough VisIt accepts 5 dozen of data formats, I can't get my data into 
 VisIt.

 I currently ran a simulation which gave me a data frame, which I wanted to 
 import into VisIt to further explore the dataframe.

 Let's say I have a data frame as follows:

 dat - data.frame(cbind(  1,   1:10),X3= sample(LETTERS[1:3], 10, 
 repl=TRUE))

 My currently data export is write.table(dat,C:/filename.csv)
 But I can't import this kind of data in Visit.
 An option is to export my dataframe as a .CDF file, but I couldn't get the 
 right output of my dataframe with netcdf.

 So how do I put my dataframe in a netCDF format, or is there anyone who 
 knows the easiest way to transport my data to VisIt?


Have you tried the ncdf package?


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] export R-data to VisIt

2007-10-19 Thread Peter Dalgaard
Bart Joosen wrote:
 Hello,

 Is there anyone porting R data to VisIt (http://www.llnl.gov/visit/)?
 Altough VisIt accepts 5 dozen of data formats, I can't get my data into VisIt.

 I currently ran a simulation which gave me a data frame, which I wanted to 
 import into VisIt to further explore the dataframe.

 Let's say I have a data frame as follows:

 dat - data.frame(cbind(  1,   1:10),X3= sample(LETTERS[1:3], 10, repl=TRUE))

 My currently data export is write.table(dat,C:/filename.csv)
 But I can't import this kind of data in Visit.
 An option is to export my dataframe as a .CDF file, but I couldn't get the 
 right output of my dataframe with netcdf.

 So how do I put my dataframe in a netCDF format, or is there anyone who knows 
 the easiest way to transport my data to VisIt?

   
Have you tried the ncdf package?


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] export R-data to VisIt

2007-10-19 Thread Bart Joosen
Hello,

Is there anyone porting R data to VisIt (http://www.llnl.gov/visit/)?
Altough VisIt accepts 5 dozen of data formats, I can't get my data into VisIt.

I currently ran a simulation which gave me a data frame, which I wanted to 
import into VisIt to further explore the dataframe.

Let's say I have a data frame as follows:

dat - data.frame(cbind(  1,   1:10),X3= sample(LETTERS[1:3], 10, repl=TRUE))

My currently data export is write.table(dat,C:/filename.csv)
But I can't import this kind of data in Visit.
An option is to export my dataframe as a .CDF file, but I couldn't get the 
right output of my dataframe with netcdf.

So how do I put my dataframe in a netCDF format, or is there anyone who knows 
the easiest way to transport my data to VisIt?


Kind Regards

Bart


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.