r output in excel

37 views
Skip to first unread message

Abdullah-Al Mamun

unread,
May 26, 2016, 4:58:06 AM5/26/16
to ggp...@googlegroups.com

Hi,

I would like to get the r output in excel or at least in tabular form. 

I got mean and sd value of about 170 samples and now struggling to put manually all of them into tabular form .

 

 

Sincerely Your's
Abdullah-Al Mamun
PhD Student, Room No. F26
Development Group
School of Natural Science
Institute of Aquaculture
University of Stirling, FK9 4LA, UK
Telephone: 01786466589, Mobile: +447438265137
Email: mamun...@yahoo.com

The University achieved an overall 5 stars in the QS World University Rankings 2015
The University of Stirling is a charity registered in Scotland, number SC 011159.

Adriano Fantini

unread,
May 26, 2016, 5:10:22 AM5/26/16
to Abdullah-Al Mamun, ggp...@googlegroups.com
I don't think this is the right mailing list to ask this question. Moreover, you may want to add to the question more details, included what you have tried so far and how is your data structured, or noone will be able to answer. Also, if you show what you have done so far, people will help you. If you don't people will assume you have not tried anything and you just want someone else to do the work in your place.

Best regards,
Adriano

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ricardo Rodríguez

unread,
May 26, 2016, 6:01:23 AM5/26/16
to ggp...@googlegroups.com
Sorry! I sent the message from not subscribed address! Cheers!

---------- Forwarded message ---------
From: [IDIS Technical Secretariat] Ricardo Rodríguez <ricardo....@idisantiago.es>
Date: Thu, May 26, 2016 at 11:15 AM
Subject: Re: r output in excel
To: Adriano Fantini <adr.f...@gmail.com>, Abdullah-Al Mamun <a.m....@stir.ac.uk>
Cc: ggp...@googlegroups.com <ggp...@googlegroups.com>


Hi! I can easily agree with Adriano but as I've been struggling with something related, please, allow me to point Abdul to openxlsx.

As always, things can be done several ways in R! After some years working with other solutions to read/write Excel files, I do think openxlsx is a must!

Cheers!
--
Ricardo Rodríguez
Research Management and Promotion Technician
Technical Secretariat
Health Research Institute of Santiago de Compostela (IDIS)

Abdullah-Al Mamun

unread,
May 26, 2016, 6:28:05 AM5/26/16
to Ricardo Rodríguez, ggp...@googlegroups.com

Hi,

Thanks a lot for the reply. I am in the learning stage and using R for my thesis. Sorry not to mention in details earlier.

I am using the following code to get the man and sd value of different fish species

aggregate (Lipid~culturesystem+Species, FUN=mean. data=all1)

and after that, I got the result and its about 167 rows. Similarly I have to assess fatty acids, protein etc. In this aspect, I would like to get the results in excel or at least in tabular form.

I tried with xtable

m2<-aggregate (Lipid~culturesystem+Species, FUN=mean. data=all1)

m3<-xtable(m2)

print.xtable(m3, type="html", file="newname.html")

but it shown --couldn't find xtable

 then I tried with openxlsx

for this I have created in new excel file named allnut.xlsx

wb<-createWorkbook("allnut")

addworksheet(wb, "Sheet 1")

read.xlsx ("allnut.xlsx")

file<-system.file ("m2) "allnut.xlsx", package="xlsx")

res<-read.xlsx(file,1)

 

one thin I notice as Error package rJava could not be loaded was found in error sign. I am using windows 10. does it related to operating system.

 

As I said I am new R user your kind help will be highly appreciated.

 

Sincerely Your's
Abdullah-Al Mamun
PhD Student, Room No. F26
Development Group
School of Natural Science
Institute of Aquaculture
University of Stirling, FK9 4LA, UK
Telephone: 01786466589, Mobile: +447438265137
Email: mamun...@yahoo.com

From: ggp...@googlegroups.com <ggp...@googlegroups.com> on behalf of Ricardo Rodríguez <ricardo.julio.ro...@gmail.com>
Sent: Thursday, May 26, 2016 10:34 AM
To: ggp...@googlegroups.com
Subject: Fwd: r output in excel
 

Abdullah-Al Mamun

unread,
May 26, 2016, 7:51:00 AM5/26/16
to dan puddephatt, ggplot2

Hi Dan,

Thank you so much. Its really helpful. Its really a great support

 

 

Sincerely Your's
Abdullah-Al Mamun
PhD Student, Room No. F26
Development Group
School of Natural Science
Institute of Aquaculture
University of Stirling, FK9 4LA, UK
Telephone: 01786466589, Mobile: +447438265137
Email: mamun...@yahoo.com

From: dan puddephatt <dpud...@gmail.com>
Sent: Thursday, May 26, 2016 12:39 PM
To: ggplot2
Cc: Abdullah-Al Mamun

Subject: Re: r output in excel
 
Hi Abdulah.
I'm assuming your output is a data frame.
If that is the case then:

install.packages("readr")
library(readr)
ofl <- "OUTPUTFILENAME.csv"     # FOR CLEANLINESS AND READABILITY
write_csv(m2, ofl)

A csv is not the same as an excel spreadsheet but pretty close.
An even easier to read approach would involve the pipe operator.

install.packages("readr")
install.packages("magrittr") # This library includes the pipe

library(readr)
library(magrittr)
ofl <- "OUTPUTFILENAME.csv" 

aggregate (Lipid~culturesystem+Species, FUN=mean. data=all1) %>%
                   write_csv(ofl)

This is read as: results of aggregate are piped into write_csv.

Best of luck and have fun.
Dan Puddephatt

dan puddephatt

unread,
May 26, 2016, 8:01:53 AM5/26/16
to ggplot2, a.m....@stir.ac.uk
Hi Abdulah.
I'm assuming your output is a data frame.
If that is the case then:

install.packages("readr")
library(readr)
ofl <- "OUTPUTFILENAME.csv"     # FOR CLEANLINESS AND READABILITY
write_csv(m2, ofl)

A csv is not the same as an excel spreadsheet but pretty close.
An even easier to read approach would involve the pipe operator.

install.packages("readr")
install.packages("magrittr") # This library includes the pipe

library(readr)
library(magrittr)
ofl <- "OUTPUTFILENAME.csv" 

aggregate (Lipid~culturesystem+Species, FUN=mean. data=all1) %>%
                   write_csv(ofl)

This is read as: results of aggregate are piped into write_csv.

Best of luck and have fun.
Dan Puddephatt

On Thursday, 26 May 2016 04:58:06 UTC-4, Abdullah-Al Mamun wrote:
Reply all
Reply to author
Forward
0 new messages