Re: [R] Teach me how to transpose in R

2009-09-27 Thread cls59



Hyo Lee wrote:
 
 
 Teach me how to deal with this problem.
 Thank you very much.
 
 -Hyo
 
 


A good thing to try if you're stuck finding the right function in R is
searching with ??. For example, if you type:

??transpose

The base routine t(), which performs a matrix transpose, is one of the first
things that comes up.

Hope that helps!

-Charlie

-
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://www.nabble.com/Teach-me-how-to-transpose-in-R-tp25630869p25631393.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Teach me how to transpose in R

2009-09-27 Thread Marcio Resende

Hi Hyo,
I am kinda of new in R but I think if you use
x - as.matrix(data2) #with the numer of collumns you wish
y - t(x)

it should work

Hope I´ve helped

Márcio



Hyo Lee wrote:
 
 Hi guys,
 I need your help!!
 
 My goal is to make a csv file from ncdf file.
 This is the code i've used :
 
 hyo=open.ncdf(C:/CRUTEM3.nc)
 hyo
 [1] file C:/CRUTEM3.nc has 4 dimensions:
 [1] longitude   Size: 72
 [1] latitude   Size: 36
 [1] unspecified   Size: 1
 [1] t   Size: 1916
 [1] 
 [1] file C:/CRUTEM3.nc has 1 variables:
 [1] float temp[longitude,latitude,unspecified,t]  Longname:Temperature T
 Missval:2.0004008175e+20
 data2=get.var.ncdf(hyo)
 write.csv(data2,file=C:/ple.csv)
 
 
 But the problem is, I expected this data would be 17000 * 72  (row* col) ;
 but, it is the other way around. 72*17000
 Because the maximum col number in excel is 16383, this cvs file doesn't
 show
 all data. Obviously, I need to transpose the matrix..
 I tried to use transpose function but failed.
 
 bbb=t(data2)
 Error in t.default(data2) : argument is not a matrix
 ccc=t(hyo)
 ccc
 [1] file  has  dimensions:
 Error in if (nc$ndims  0) for (i in 1:nc$ndims) { :
   argument is of length zero
 
 Teach me how to deal with this problem.
 Thank you very much.
 
 -Hyo
 
   [[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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Teach-me-how-to-transpose-in-R-tp25630869p25630947.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Teach me how to transpose in R

2009-09-26 Thread milton ruser
*Hum*

bbb=t(as.matrix(data2)) ?

good luck

milton




On Sun, Sep 27, 2009 at 12:39 AM, Hyo Lee totem...@gmail.com wrote:

 Hi guys,
 I need your help!!

 My goal is to make a csv file from ncdf file.
 This is the code i've used :

  hyo=open.ncdf(C:/CRUTEM3.nc)
  hyo
 [1] file C:/CRUTEM3.nc has 4 dimensions:[1] longitude   Size: 72
 [1] latitude   Size: 36
 [1] unspecified   Size: 1
 [1] t   Size: 1916
 [1] 
 [1] file C:/CRUTEM3.nc has 1 variables:
 [1] float temp[longitude,latitude,unspecified,t]  Longname:Temperature T
 Missval:2.0004008175e+20
  data2=get.var.ncdf(hyo)
  write.csv(data2,file=C:/ple.csv)


 But the problem is, I expected this data would be 17000 * 72  (row* col) ;
 but, it is the other way around. 72*17000
 Because the maximum col number in excel is 16383, this cvs file doesn't
 show
 all data. Obviously, I need to transpose the matrix..
 I tried to use transpose function but failed.

  bbb=t(data2)
 Error in t.default(data2) : argument is not a matrix
  ccc=t(hyo)
  ccc
 [1] file  has  dimensions:
 Error in if (nc$ndims  0) for (i in 1:nc$ndims) { :
  argument is of length zero

 Teach me how to deal with this problem.
 Thank you very much.

 -Hyo

[[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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[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.