[R] Selecting cell values with XLSX package

Jim Lemon drjimlemon at gmail.com
Thu Apr 23 14:09:27 CEST 2015


Hi samarvir,
Your attachment didn't make it through the list filter. From your
example, you seem to want something like this:

# assume you are using the readxl package to read the data in
mydf<-read_excel("mydata.xlsx",col_types=rep("character",11))
mydatavector<-as.vector(as.matrix(mydf))

This is probably not what you need, as each spreadsheet file will be
turned into a long vector of character (string) values. What you
probably should think of is reading in the spreadsheets:

mydf1<-read_excel("mydata1.xlsx")
mydf2...

and merging the resulting data frames. With that many data files, you
will probably have to do this in stages.

Jim


On Thu, Apr 23, 2015 at 9:36 PM, samarvir singh <samarvir1996 at gmail.com> wrote:
> Hello,
>
> I am working with some 2700 files in .xlsx format
> Like the one attached below
>
> I want to transform all tabular data to a single row as shown below in
> example or in attachment
> so that all data can be used as a variable.
> and replicate all to make a single csv file which has all the data
>
> EXAMPLE
>
>   company SALE-9 SALE-8 SALE-7 SALE-6 SALE-5 SALE-4 SALE-3 SALE-2 SALE-1
> SALE op-9  MARUTI SUZUKI INDIA LIMITED 11046.3 12197.9 14806.4 18066.8
> 20729.4 29317.7 36618.4 35587.1 43587.9 43700.6 1570.3  Nextcompany name …
>
> Thanks for your help. help me however you can.
>  Really appreciate you taking the time.
> please see the attachment. thank you.
> I would love to share the findings, Whatever I can find.
> P.S - every file is of same format
>
>  thank you.
> ______________________________________________
> R-help at 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