Hello R community, I basically created a normal distribution with mean 2500 and standard deviation = 450 with a sample of size 50 and assigned that to a variable named genvar2 with the following command: genvar2<-rnorm(mean=2500, sd=450, n=50) Now, the output of genvar2 generates de following: [1] 2478.126 2671.259 2163.879 2440.796 2702.234 1871.514 2525.127 2830.688 [9] 2704.148 3464.478 2609.795 3368.288 2661.613 2731.901 2535.846 2165.461 [17] 1870.069 3513.533 2053.342 2447.887 2605.913 2188.192 2514.004 2965.374 [25] 3550.454 1783.323 2568.323 2324.673 2528.994 2433.895 2751.111 2727.282 [33] 1837.081 1896.721 3445.993 1357.462 2348.177 2368.423 2029.738 2500.372 [41] 2000.008 3088.112 3003.325 2763.740 2475.636 1860.988 2292.909 2134.172 [49] 2291.116 2851.066 I want to export all of these numbers into a column in an excel file (in an xlsx and .csv format). How can I do this? Any help will be greatly appreciated, Best regards, Paul [[alternative HTML version deleted]]
Roy Mendelssohn
2012-May-01 21:05 UTC
[R] How to Export an R outcome to an Excel Spreadsheet
?write.table Googling it would find the same thing -Roy On May 1, 2012, at 1:41 PM, Paul Bernal wrote:> Hello R community, > > I basically created a normal distribution with mean 2500 and standard > deviation = 450 with a sample of size 50 and assigned that to a variable > named genvar2 with the following command: > > genvar2<-rnorm(mean=2500, sd=450, n=50) > > Now, the output of genvar2 generates de following: > > [1] 2478.126 2671.259 2163.879 2440.796 2702.234 1871.514 2525.127 2830.688 > [9] 2704.148 3464.478 2609.795 3368.288 2661.613 2731.901 2535.846 2165.461 > [17] 1870.069 3513.533 2053.342 2447.887 2605.913 2188.192 2514.004 2965.374 > [25] 3550.454 1783.323 2568.323 2324.673 2528.994 2433.895 2751.111 2727.282 > [33] 1837.081 1896.721 3445.993 1357.462 2348.177 2368.423 2029.738 2500.372 > [41] 2000.008 3088.112 3003.325 2763.740 2475.636 1860.988 2292.909 2134.172 > [49] 2291.116 2851.066 > I want to export all of these numbers into a column in an excel file (in an > xlsx and .csv format). > > How can I do this? > > Any help will be greatly appreciated, > > Best regards, > > Paul > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.********************** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ********************** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center 1352 Lighthouse Avenue Pacific Grove, CA 93950-2097 e-mail: Roy.Mendelssohn at noaa.gov (Note new e-mail address) voice: (831)-648-9029 fax: (831)-648-8440 www: http://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected" "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
MacQueen, Don
2012-May-03 18:30 UTC
[R] How to Export an R outcome to an Excel Spreadsheet
The others have made suggestions for csv output. For xlsx output go to CRAN, click on the packages link at the left, then select packages listed by name. Then use your browser to search for the string 'xls". There are several packages that offer this capability. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/1/12 1:41 PM, "Paul Bernal" <paulbernal07 at gmail.com> wrote:>Hello R community, > >I basically created a normal distribution with mean 2500 and standard >deviation = 450 with a sample of size 50 and assigned that to a variable >named genvar2 with the following command: > >genvar2<-rnorm(mean=2500, sd=450, n=50) > >Now, the output of genvar2 generates de following: > >[1] 2478.126 2671.259 2163.879 2440.796 2702.234 1871.514 2525.127 >2830.688 > [9] 2704.148 3464.478 2609.795 3368.288 2661.613 2731.901 2535.846 >2165.461 >[17] 1870.069 3513.533 2053.342 2447.887 2605.913 2188.192 2514.004 >2965.374 >[25] 3550.454 1783.323 2568.323 2324.673 2528.994 2433.895 2751.111 >2727.282 >[33] 1837.081 1896.721 3445.993 1357.462 2348.177 2368.423 2029.738 >2500.372 >[41] 2000.008 3088.112 3003.325 2763.740 2475.636 1860.988 2292.909 >2134.172 >[49] 2291.116 2851.066 >I want to export all of these numbers into a column in an excel file (in >an >xlsx and .csv format). > >How can I do this? > >Any help will be greatly appreciated, > >Best regards, > >Paul > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at 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.