An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130328/83a467fb/attachment.pl>
How to search in each excel in my working dir and extract part information of one product in each country?
3 messages · Tammy Ma, John Kane, jim holtman
-----Original Message----- From: metal_licaling at live.com Sent: Thu, 28 Mar 2013 11:24:43 +0300 To: r-help at r-project.org Subject: [R] How to search in each excel in my working dir and extract part information of one product in each country? Hello, I have created many excel files in my working dir.
Why?
each excel file contain one country's data. In the excel, I have dataframe in sheet1, where each product and its relative information is in each row as following: Product PE Retail_price_Band Country Model_Fit A -2.5 0-50 CN 84% B -2.1 51-100 CN 90% ..... not every product presents in each country, in other words, they may have common products or not. How do I create program in R to search each excel file in my working dir in order to make the list of the such product for each country based on my input(for example, I want to have all information related to product B in each country) the result what I want: Product PE Retail_price_Band Country Model_Fit B -2.4 51-100 IN 80% B -2.1 51-100 CN 90% How do I achieve this? thanks. Kind regards, Lingyi
If you are doing the original analyses in R why not just run them put the results for the countries in a list. Then just convert the list to a data.frame and subset. Quick and dirty example. md1 <- data.frame(aa = 1:10, b = letters[1:5]) md2 <- data.frame(aa = 11:20, b = letters[6:10]) mlist <- list(md1,md2) dd1 <- do.call(rbind.data.frame, mlist) ____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130328/57c040cf/attachment.pl>