[R] Kindly Guide

@vi@e@gross m@iii@g oii gm@ii@com @vi@e@gross m@iii@g oii gm@ii@com
Fri Jul 15 03:14:44 CEST 2022


We all face  error but the difference is whether we tell us what the error
message says or assume they will know magically.

Sarcasm aside, I hope the upper case "W" was not in the code they claim they
used:

Write.xlsx(x, "table name.xlsx")

Otherwise, I have a series of dumb questions before I can be of help.

- Are they using the "xslx" package or something else?
- Did they ever install it on that machine with install.packages("xlsx")
successfully as well as dependencies.
- Did they run this command in this session before trying it:
library("xlsx")
- Do they have a variable named x with suitable content or did they read the
manual page which mentions an x=arg, file=arg, sheetName=arg
- If they have a variable actually named x, is it of class data.frame
(perhaps also a tibble or data.table) and it is not a data.frame, either
make it into one (as in if it is something like a vector or list or matrix
if those are not automatically handled) or USE SOME OTHER FUNCTION that
handles it.
- Do they have write permission on the current folder or enough empty space
etc.
- Are you trying to append to an existing file or making a new one?
- And the big question. What was the error message and might that mean
revisiting one of the above that has not been checked already?

Once that works, you need to think carefully about whether to accept the
default sheetName or specify another or accept where it puts the data. Some
such functions allow you to specify a starting cell within the .XSLX file.

And, just FYI, in many cases you do not need to do any of this. You can save
a data.frame into a .CSV file and EXCEL can happily open that and display it
and, if you want, save it again as one of many formats including .XSLX ...

The above is not exhaustive but meant to point out that an unspecified error
(or merely the absence of an output file) is not enough to diagnose
anything.  I have had people who copied perfectly good lines of code
precisely then neglected to hit RETURN and asked why it did not work. Hard
to even imagine diagnosing that remotely without asking really silly
questions like do you know how to get the program to know when you are
finished.

I apologize if I am unkindly guiding.

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Ebert,Timothy Aaron
Sent: Thursday, July 14, 2022 3:51 PM
To: Muhammad Zubair Chishti <mzchishti using eco.qau.edu.pk>; r-help using r-project.org
Subject: Re: [R] Kindly Guide

I went to google and typed in "save excel in r" and got a few hits:
http://www.sthda.com/english/wiki/writing-data-from-r-to-excel-files-xls-xls
x
This is a good site, but there are others:
https://www.statology.org/r-export-to-excel/
https://www.geeksforgeeks.org/how-to-export-a-dataframe-to-excel-file-in-r/

and many more.


Tim

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Muhammad Zubair
Chishti
Sent: Thursday, July 14, 2022 3:40 PM
To: r-help using r-project.org
Subject: [R] Kindly Guide

[External Email]

Dear Experts,
I have obtained the results through applying Time Varying VAR model in R.
Now I want to save my results in a excel sheet. Kindly guide me how to
create a excel or excel table. Although I have tried the following code but
I face error.
Write.xlsx(x, "table name.xlsx")

Kindly guide.

Regards
Chishti

        [[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_li
stinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m
=UJkYmZ1qWcJJ0LfLyhLuxeXL_y05ktVLqPyzmV69ar6sOhNRtsVRKTuwDCus8Mlb&s=0nYlal67
UZo9DLRtun3VyrocJ90_iskyiDTI19r8CkQ&e=
PLEASE do read the posting guide
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_post
ing-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&
m=UJkYmZ1qWcJJ0LfLyhLuxeXL_y05ktVLqPyzmV69ar6sOhNRtsVRKTuwDCus8Mlb&s=b9wQQfF
dvLd-7HavGZlIhz3vR587ZiZye-3rVJJ9i9I&e=
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



More information about the R-help mailing list