Have a look at ?array
its use in comparison to MATLAB's reshape is in fact described in the Hiebeler-matlabR.pdf that Arien mentioned yesterday. If you want to stick to MATLAB-like syntax, the matlab package has a function reshape that should do exactly what you want: http://cran.r-project.org/web/packages/matlab/ There is a wealth of information out there on porting code between R and Matlab as well as basic R functionalities. http://www.rseek.org and the R-help mailing list have been mentioned before. Best, Philipp On 10.02.2011 01:07, waqar younas wrote: > Thank you very much for your kind response. > I looked at the document and found the alternative of size in R which > dim(). But the reshape function in the document for MATLAB is not > completely specified. In MATLAB when we do reshape, we simply use this > command, > > if my file name "data" has this dimension (12,396*10) and i want to > change it into three dimension then i will use in MATLAB as > > reshape(data,120,396,10). > > In the document you sent to me, the reshape function for MATLAB is > only given for 2 dimension and i think the script of the function is > not correct. That is why its alternative in R is also limited to 2 > dimension. > > Can you help me in this regard? > > > On Wed, Feb 9, 2011 at 4:20 PM, Philipp Boersch-Supan > <p...@st-andrews.ac.uk <mailto:p...@st-andrews.ac.uk>> wrote: > > Hi Younas, > > have a look at the R-MATLAB dictionary: > http://mathesaurus.sourceforge.net/octave-r.html > It should be a great resource for you if you are familiar with > MATLAB commands and want to klnow the R equivalents. > > Best, > Philipp > > Philipp Boersch-Supan, MRes > > Pelagic Ecology Research Group > University of St. Andrews > > Current Address: > University of Oxford > Department of Zoology > South Parks Road > Oxford > OX1 3PS > United Kingdom > > > > On 10/02/2011 00:03, waqar younas wrote: > > Thank you very much to all of you. > It was very helpful. Now i am able to read the data in R in > txt format. Now > i want to know how to check the size of data and reshape the > data in R? As > in Matlab we just write size(data) and reshape(data,..). How > can we do that > in R? > My data size (from MATLAB) is 120,396*10). I want to reshape it as > 120,396,10. > > On Wed, Feb 9, 2011 at 3:24 AM, Thiago > Veloso<thi_vel...@yahoo.com.br > <mailto:thi_vel...@yahoo.com.br>>wrote: > > Younas, > > Although I don't know what are the specific data you need > to analyze or > the tests you need to perform, some packages can certainly > be recommended. > "RnetCDF" and "raster" are great to import netCDF files. > NCAR's > "verification" package ( > http://cran.r-project.org/web/packages/verification/index.html) > offers > useful tools for analysing probabilistic or deterministic > forecasts. Package > "clim.pact" > (http://cran.r-project.org/web/packages/clim.pact/index.html) > might be useful as well. > > Hope it helps, > > Thiago. > > --- On Tue, 8/2/11, waqar younas<vicky...@gmail.com > <mailto:vicky...@gmail.com>> wrote: > > From: waqar younas<vicky...@gmail.com > <mailto:vicky...@gmail.com>> > Subject: [R-sig-Geo] About R > To: cmbar...@ucdavis.edu > <mailto:cmbar...@ucdavis.edu>, r-sig-geo@r-project.org > <mailto:r-sig-geo@r-project.org> > Date: Tuesday, 8 February, 2011, 22:50 > Hi > I am PhD Candidate in UNBC, Canada and working on seasonal > climate > prediction data analysis. Currently, i am using MATLAB but > i also want to > use R for probabilistic verification package. I do not > know > even how to read > data in R. First of all, i read the manual of R, but it is > not written > clearly which data formats R supports? In MATLAB, i can > save my data into > grid format so i want to know, how grid data can be read > able in R. There is > interface people use so that R can be called within > MATLAB, > but i do not > know how? > > -- > Best Regards > > Waqar Younas > PhD Candidate > Natural Resources and Environmental Studies (NRES) > University of Northern British Columbia (UNBC) > Canada > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org <mailto:R-sig-Geo@r-project.org> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > > > > > > > > -- > Best Regards > > Waqar Younas > PhD Candidate > Natural Resources and Environmental Studies (NRES) > University of Northern British Columbia (UNBC) > Canada > -- Philipp Boersch-Supan, MRes Pelagic Ecology Research Group University of St. Andrews Current Address: University of Oxford Department of Zoology South Parks Road Oxford OX1 3PS United Kingdom [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo