[R] How to search in each excel in my working dir and extract part information of one product in each country?

2013-03-28 Thread Tammy Ma
Hello, I have created many excel files in my working dir. 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: ProductPERetail_price_Band Country Model_Fit A

[R] How to list the all products' information of the latest month?

2013-03-15 Thread Tammy Ma
Hi, I have data frame like this: Product PriceYear_Month PE A 100201012 -2 A 98 201101-3 A 97 201102-2.5 B 110 201101-1 B 100

[R] How to make the labels of pie chart are not overlapping?

2013-03-15 Thread Tammy Ma
I have the following dataframe: Productpredicted_MarketShare Predicted_MS_Percentage A2.827450e-02 2.8 B4.716403e-06 0.0 C1.741686e-01 17.4 D

[R] how to change `Year_Month)201103` into Year_Month)201103 using R?

2013-03-14 Thread Tammy Ma
HI, I have the pattern like `Year_Month)201103` I want to delete single quotes within double quetes. I want to change it into Year_Month)201103 , how to do it in r? Thanks a lot. Tammy [[alternative HTML version deleted]]

[R] HOw to achieve big vector times big dataframe in R?

2013-03-14 Thread Tammy Ma
HI, I have the following question: Vector a with lenght 150 A B C D. dataframe b with dim 908X150 1 1 1 1. 2 2 2 2 3 3 3 3 4 4 4 4 final result I want is the vector with length 908: A*1+B*1+C*1+D*1+. A*2+B*2+C*2+D*2+.

[R] Excel User interface for R

2013-03-04 Thread Tammy Ma
HI, Assume I have the data frame generated from R as the following: Product Price market_share A 10010% B 1109% C 12020% D 90 61% What I want to do is to have this kind of excel user interface by

[R] How to name the elements of list

2013-01-25 Thread Tammy Ma
HI, I have the array list: X-vector(list, 2) X[[1]] : data frame 1 X[[2]]: dataframe2 now i want to change index 1 and 2 into: 0-10 , 11-20 ,. finally I want to have X[[0-10]]:dataframe1 X[[11-20]]:dataframe2 how do I get them? Thanks a lot. Kind regards, Tammy

Re: [R] How to name the elements of list

2013-01-25 Thread Tammy Ma
, FRANCE +33(0)3.80.39.63.06 ivan.calan...@u-bourgogne.fr http://biogeosciences.u-bourgogne.fr/calandra Le 25/01/13 10:39, Tammy Ma a écrit : HI, I have the array list: X-vector(list, 2) X[[1]] : data frame 1 X[[2]]: dataframe2 now i want to change index 1 and 2 into: 0

[R] How to load data from .accdb into R?

2013-01-25 Thread Tammy Ma
HI, All, I have three dabases: analysis_tool.accdb is linked into sellout.mdb and audit.accdb. whenever I use this database, I need to firstly open analysis_tool, then press External data-Linked Table Manager to link the other two databases. Now I want to load the data from those database

[R] how to delete the null elements in list

2013-01-25 Thread Tammy Ma
HI, I have the list: suu [[1]] NULL [[2]] NULL [[3]] item_id prod 1 2 [[4]] item_id prod 1 2 2 4 how to delete all NULL elements from suu to get only suu [[3]] item_id prod 1 2 [[4]] item_id prod 1 2 2 4 ?? Kind

[R] how to combine unequal rows and columns in R

2013-01-24 Thread Tammy Ma
HI, I have the following list: crosspries $crosspries[[1]] Product Year_Month prod1 A 2012081 B 2012082 C 2012081 $crosspries[[2]] Product Year_Monthprod1

[R] how should I make the optional arguments in r?

2013-01-24 Thread Tammy Ma
HI, I guess I did sth wrong with the optional argument in the program. but I don't know how should I make it. in my main program: source(getelasticity_overPB.r) crossprice-getelasticity(mydata,mydatao,nest)$cross_p is same with crossprice-getelasticity(mydata,mydatao)$cross_p I don't know

[R] How to align group based on the common values of two columns in r

2013-01-22 Thread Tammy Ma
HI, I met this problem: I have the feature data frame: Feature OS 4 2 4 1 4 3 1 2 4 1 what I want to do is to autimatically create one more column called group: Feature OS Group

Re: [R] How to import the large dataset into R

2012-12-17 Thread Tammy Ma
does anybody can help me on this? From: metal_lical...@live.com To: r-help@r-project.org Subject: How to import the large dataset into R Date: Fri, 14 Dec 2012 11:01:03 +0300 HI, R Users, I met the following problem: I was trying to import data of one table in .accdb database into my ODBC

[R] How to import the large dataset into R

2012-12-14 Thread Tammy Ma
HI, R Users, I met the following problem: I was trying to import data of one table in .accdb database into my ODBC database for being imported into R. The table contains 1021965 records. I always got the following error msg even I change the drive: The query can not be completed. Either the

[R] how to aggregate the data ?

2012-12-13 Thread Tammy Ma
HI, now I have dataset: Product Price_LC.1 Price_LC.2 Price_elasticity.1 Price_elasticity.2 Mean_Price Mean_Price_elasticity Trade_Price_Band Country 1 100 357580.1 527483.6 -4.1498383 -2.8459564 473934.0

[R] How to aggregate the dataset?

2012-12-13 Thread Tammy Ma
HI, I want to transform the following dataset Product Price_LC.1 Price_LC.2 Price_elasticity.1 Price_elasticity.2 Mean_Price Mean_Price_elasticity Trade_Price_Band Country 100 35 52 -4.14 -2.84 47 -3.69

[R] how to aggregate the dataset

2012-12-13 Thread Tammy Ma
HI, Sorry for messing up.. I want to transform the following dataset: product min_price max_price mean_price country price_band 11 34 50 40 VN 0-300 22 10 30 15 VN 0-300 Into:

Re: [R] how to aggregate the dataset

2012-12-13 Thread Tammy Ma
Really sorry for messing up. I want to transform: product min_price max_price mean_price country price_band 11 34 50 40 VN 0-300 2210 30

[R] How to create multiple country's data into multiple sheets of one excel

2012-12-13 Thread Tammy Ma
HI, I have large dataset of many countries. I have written the program to run through each country to generate one output for each country. I want to put the output like this: one sheet has output for one country. How do I achieve it by r. I have tried this: library(xlsx) write.xlsx(nnn,

[R] how to grep in r

2012-12-12 Thread Tammy Ma
Hi, I met this problem. Trade_Price_Band x 1 0-30 0.6237240 2 101-150 0.6743857 3 151-200 0.6778513 4 201-300 0.6640293 5 301-400 0.6630991 6 31-50 0.6314547 7 401-500 0.6776249 8 500+ 0.6557705

[R] how to assign factor level into each value

2012-12-05 Thread Tammy Ma
HI, All I met the following problem. I dont know how to handle it. Country Price 1 CN 44.25 2 CN 21.07 3 CN 92.70 4 CN 47.41 5 CN

Re: [R] map two names into one

2012-11-08 Thread Tammy Ma
Thanks. Yes. Your approach can identify: Glaxy ace S 5830 and S 5830 Glaxy ace But you can not identify using same program: Iphone 4S 16 G Iphone 4S 16G How should I solve both in same time. Kind regards,Tammy [[alternative

[R] How to read all table in r using dbreadTable, autimatically read in whenever I save new table in SQLite db

2012-11-06 Thread Tammy Ma
HI, I got the problem. I use the following query to read table individually, how can I read all tables autimatically rather than typing week42 week33 in dbReadTable? library(RSQLite) library(sqldf) drv - dbDriver(SQLite) con-dbConnect(drv, sqlite.db) dbListTables(con) #dbRemoveTable(con,

[R] how Can make function for selecting the products

2012-11-06 Thread Tammy Ma
HI. I make this code: getdata-function('a','b','c' ,'d','e','f'){ drv - dbDriver(SQLite) con-dbConnect(drv, sqlite.db) lt-dbListTables(con) myf-data.frame(NULL) for (i in 1:length(lt)) { myfile-dbReadTable(con,lt[i]) myfile1-myfile[-c(14:44)] myfile1$MODEL-gsub( , , myfile1$MODEL)

[R] can not read table in dbReadTable

2012-11-02 Thread Tammy Ma
tbs-dbListTables(con) tbs [1] lowend time week30 week33 week39 week42 my.data.copy - dbReadTable(tbs, week42) Error in function (classes, fdef, mtable) : unable to find an inherited method for function dbReadTable, for signature character, character I have created tables in db. but

[R] Which test should I use for comparing the change of two samples

2012-10-29 Thread Tammy Ma
Dear All, I have two samples as the following: conjps-c(9.41,10.45,10.78,10.73,11.11,11.12,11.59,11.04,11.63) ms-c(4.11,5.10,5.70,6.46,6.04,6.16, 6.24,6.32,7.33) I want to test the change of sample is same to the another one. conjps_ch-c(1.04,0.33.) ms-c(0.99,0.60,0.76) which test I

[R] How to replace the row number for each product by real product name in as.dendrogram in cluster analysis..HELP!

2012-10-26 Thread Tammy Ma
data1-data.matrix(newdata) # transforming the factor into different values data.use-data1[,-c(1,2,3)] # leaving the value matrix data.dist = dist(data.use) data.hclust = hclust(data.dist) #complete linkage is used #if I plot the following one, I have too large data set(rows`=9980), can not

[R] Instrumental variables for the competitive price

2012-10-25 Thread Tammy Ma
Dear R user, I have been setting up the models for predicting the volume based on the price information of own product and competitive products. one option is to use instrumental variable to break price into two parts: one part that might be correlated with error term, and the another part

[R] Testing the equality of two variances

2012-10-22 Thread Tammy Ma
Dear R-User, I met the problem to test equality of variance. Two sample units: conjps-c(9.41,10.45,10.78,10.73,11.11,11.12,11.59,11.04,11.63) ms-c(4.11,5.10,5.70,6.46,6.04,6.16, 6.24,6.32,7.33) Then I use the F test to test: •Test Equality of Two Variances F test to compare two variances

[R] map two names into one

2012-09-26 Thread Tammy Ma
Dear R user: I have got the following problem: I have imported two data sets into R: one set includes price information, another one includes volume information. but I noticed the wrong data order problem in the product name, for instance, in one data set, GALAXY ACE S 5830 in another

[R] missing price datas before launched

2012-07-03 Thread Tammy Ma
HI, I have the price and volume data from own product and competitor's product: Year_Month Volume own product's price Volume competitor's price 1 201011 17583469.03 NA NA 2 201012 33899

[R] Day or Month difference between dates???

2012-06-01 Thread Tammy Ma
HI, R-Users: I got a questions. have been struggling so long time I have this data: m1$Year_Month 201009 201010 201011 201101 201102 min(m1$Year_Month) 201009 I want to calculate the following two answers, how do I program it? difference in Month? [1] 0 1 2 4 5 difference

[R] How to import .accda database into R

2012-05-09 Thread Tammy Ma
Dear R user: How to import .accda database into R? I have tried many ways, still doesn't work. Thanks in advance. Kind regards, Tammy [[alternative HTML version deleted]] __ R-help@r-project.org

[R] Please Help me!

2009-10-02 Thread Tammy Ma
Hi, R-users, I have a problem: Because there are few files which can't be readed into R completely, so on the following subsequence programme, I use write.table, which creates the NA files for those incomplete files autimatically. I don't want those NA files. My programes formats looks like:

[R] The problem of readLines

2009-10-01 Thread Tammy Ma
Dear R-users, I use readLines to read data, but when processing the large data set, there are few files which can not be readed in: 48: In readLines(name_c[i]) ... : incomplete final line found on 'C:/Documents and Settings/lma/My

Re: [R] Debug

2009-10-01 Thread Tammy Ma
From: metal_lical...@live.com To: r-help@r-project.org Subject: Debug Date: Thu, 1 Oct 2009 15:21:42 +0300 Hi, R-Users,' I have written a programe to process the bunch of files in one folder. But there is a error came out; How can I know which file returns error when being processed? I

Re: [R] The problem of readLines

2009-10-01 Thread Tammy Ma
, with a warning. You can disable the warning with; readLines('your_file', warn = FALSE) On Thu, Oct 1, 2009 at 9:39 AM, Tammy Ma metal_lical...@live.com wrote: Dear R-users, I use readLines to read data, but when processing the large data set, there are few files which can not be readed

[R] Change directory to implement same programes

2009-09-30 Thread Tammy Ma
HI, R-Users, I have one problem: I have written the the programs which process all file in one directory: for example: setwd(C:/Documents and Settings/lma/My Documents/Vappu-saved/Log) as the start. .. But I have many folders like Vappu-saved and there are a lot of files in each

Re: [R] Change directory to implement same programes

2009-09-30 Thread Tammy Ma
How do I source a bunch of files in different directories in R? From: metal_lical...@live.com To: r-help@r-project.org Date: Wed, 30 Sep 2009 13:45:34 +0300 Subject: [R] Change directory to implement same programes HI, R-Users, I have one problem: I have written the the programs

[R] How to parsing data like this in R

2009-09-29 Thread Tammy Ma
Hi, R-users, I met a problem: Items:[Anna 'moi =) akku loppu joskus 4ltä. Kestää kauan nää..'\tAmer, Tuusula (0:20)\t20\t12\t16\t00\t00\t11]/Anne 'Ei jakoa,uus päivä muistio et 4n niin peruin. Hups'\t (0:16)\t0\t12\t18\t00\t00\t11/Elina 'Konsertissa. En tod. vastaa teille'\tEtu-Töölö,

[R] Manipulate directory-help

2009-09-22 Thread Tammy Ma
Dear R-users, I have a problem: I have many files in the directory:C:/Documents and Settings/lma/Desktop/FamilyAEntrepreneurs/Entrepreneurs/Juha I want to copy those files into the new directory: C:/Documents and Settings/lma/My Documents/Juha/book (-use paste), I first create the directory

[R] Create directory and copy files in R

2009-09-21 Thread Tammy Ma
HI, All R users, My problem is: fn [1] C:/Documents and Settings/lma/Desktop/FamilyAEntrepreneurs/Entrepreneurs/Juha/book_log-20041210T095019.txt dpath [1] C:/Documents and Settings/lma/My Documents/Juha/book I want to make a function cyfun to copy all files in dir to deskdir but I

[R] power analysis for 2-way anova

2009-09-04 Thread Tammy Ma
Dear R-help list, Does anyone have a function that I could use to determine power for 2 way Anova?? an A x B repeated measures study,power is 0.95, I'd like to draw separate lines for three different combinations of A and B: (2,2), (2,5), (2,8). Thanks a lot. Tammy

[R] data frame

2009-09-01 Thread Tammy Ma
HI, R user, I generate the vectors with the same length. I want to put each vector into each column of data frame. Why it doesnt work`? rm-data.frame() for(a in 1:6){ rm[,a]-getmeasure(p1,a,speech) } thanks a lot Tammy _

[R] Generate random sample interval

2009-08-24 Thread Tammy Ma
Hi, R users, I have a problem about how to generate random sample interval from a duration. For example, during a time duration 0-70s, I want to generate a sample which last 10s. the sample could be 0-10 or 30-40s or 25-35s etc How could I do it in R`?? Thanks a lot. Tammy

Re: [R] Generate random sample interval

2009-08-24 Thread Tammy Ma
I need a simple algorithm to generate random ranges. From: metal_lical...@live.com To: r-help@r-project.org Date: Mon, 24 Aug 2009 09:55:35 +0300 Subject: [R] Generate random sample interval Hi, R users, I have a problem about how to generate random sample interval from a duration.

[R] Matrix manipulation

2009-04-28 Thread Tammy Ma
From: metal_lical...@live.com To: r-help@r-project.org Subject: About Matrix Date: Tue, 28 Apr 2009 11:28:43 +0300 Hi, Dear R users, I have a question: I have A matrix which is 11519X14 and B matrix which is 1764X14, How do I get C matrix which is The remaining matrix after

[R] About Matrix

2009-04-28 Thread Tammy Ma
Hi, Dear R users, I have a question: I have A matrix which is 11519X14 and B matrix which is 1764X14, How do I get C matrix which is The remaining matrix after removing B from A? Thanks a lot. Kind regards, Tammy _ More than

[R] About the proportion of data

2009-03-31 Thread Tammy Ma
Hi, All. I have scatterplot in 2-D I'd like to see which proportion of data goes into a range. How shall I figure it out? Perhaps some accumulative graph or something? Kind regards, Tammy _ Drag n’ drop—Get easy photo sharing

[R] Merging.

2009-03-17 Thread Tammy Ma
Hi, All. I have a data frame with the part as : . 1422006-02-22 16:28:18 useractivity_act 8 0 1432006-02-22 16:28:26 42 0 1442006-02-22 16:28:28 33 0 1452006-02-22 16:28:31

[R] Merging

2009-03-17 Thread Tammy Ma
Hi, All. I have a data frame with the part as : . 1422006-02-22 16:28:18 useractivity_act 8 0 1432006-02-22 16:28:26 42 0 1442006-02-22 16:28:28 33 0 1452006-02-22 16:28:31

Re: [R] Merging

2009-03-17 Thread Tammy Ma
Thanks for your reply, I couldn't use the method what the example gives. Because Data frame is quite big, and it has so many rows which are repeated. I am not pretty sure about the range of 1000. It turns out I should merge those row which repeated. Tammy From: simon.pick...@bto.org To:

Re: [R] Merging

2009-03-17 Thread Tammy Ma
Sorry, I didn't sent it twice, but there is some problem on my emailSorry for this. Tammy From: metal_lical...@live.com To: r-help@r-project.org Date: Tue, 17 Mar 2009 11:49:10 +0200 Subject: [R] Merging Hi, All. I have a data frame with the part as : . 142

Re: [R] Merging

2009-03-17 Thread Tammy Ma
('n' is the original data frame)? n v V1 V2 V3 V4 1 k a 2 1 2 2 l b 1 2 1 3 m c 2 1 2 4 n d 1 2 1 5 o e 2 1 2 n1 - n[,3:5] n2 - duplicated(n1) n3 - n[!n2,] n3 v V1 V2 V3 V4 1 k a 2 1 2 2 l b 1 2 1 Pankaj Tammy Ma wrote: Thanks

Re: [R] Merging

2009-03-17 Thread Tammy Ma
Does anyone know the solution`? Thanks, Tammy From: metal_lical...@live.com To: r-help@r-project.org Date: Tue, 17 Mar 2009 11:49:10 +0200 Subject: [R] Merging Hi, All. I have a data frame with the part as : . 1422006-02-22 16:28:18 useractivity_act 8 0

Re: [R] Merging

2009-03-17 Thread Tammy Ma
I still couldn't solve itany help would be preciated! Tammy From: metal_lical...@live.com To: r-help@r-project.org Date: Tue, 17 Mar 2009 11:49:10 +0200 Subject: [R] Merging Hi, All. I have a data frame with the part as : . 1422006-02-22 16:28:18

Re: [R] Merging

2009-03-17 Thread Tammy Ma
3 159 25 hth Keith J Tammy Ma schrieb: I still couldn't solve itany help would be preciated! Tammy From: metal_lical...@live.com To: r-help@r-project.org Date: Tue, 17 Mar 2009 11:49:10 +0200 Subject: [R] Merging Hi, All

Re: [R] Merging

2009-03-17 Thread Tammy Ma
-22 16:28:31 4 4 1 5 2006-02-22 16:28:18 useractivity_act 8 0 6 2006-02-22 16:28:35 3 159 25 hth Keith J Tammy Ma metal_lical...@live.com wrote in message news:bay0-dp3-858363e64f6ed84f9f6f486...@phx.gbl... My aim is not only relect

[R] Removing

2009-03-12 Thread Tammy Ma
Hi All, act_2 DateDtime Hour Min Second Rep 51 2006-02-22 14:52:18 14 52 18 useractivity_act 52 2006-02-22 14:52:18 14 52 18 4 55 2006-02-22 14:52:49 14 52 49 4 57 2006-02-22 14:52:51 14 52 51

[R] Removing rows

2009-03-12 Thread Tammy Ma
Hi All, act_2 DateDtime Hour Min Second Rep 51 2006-02-22 14:52:18 14 52 18 useractivity_act 52 2006-02-22 14:52:18 14 52 18 4 55 2006-02-22 14:52:49 14 52 49 4 57 2006-02-22 14:52:51 14 52 51

[R] who can give me some hint?

2009-03-12 Thread Tammy Ma
Hi All, act_2 DateDtime Hour Min Second Rep 51 2006-02-22 14:52:18 14 52 18 useractivity_act 52 2006-02-22 14:52:18 14 52 18 4 55 2006-02-22 14:52:49 14 52 49 4 57 2006-02-22 14:52:51 14 52 51

Re: [R] who can give me some hint?

2009-03-12 Thread Tammy Ma
[-nr]) act_2[ix] On Thu, Mar 12, 2009 at 6:25 AM, Tammy Ma metal_lical...@live.com wrote: Hi All, act_2 DateDtime Hour Min Second Rep 51 2006-02-22 14:52:18 14 52 18 useractivity_act 52 2006-02-22 14:52:18 14 52 18 4

[R] debug

2009-03-12 Thread Tammy Ma
Hi, All I have so many files in my directory. I got the following error. At this time, I couldn't use debug() to check error one by one because so many files getting invloved. How can I get some idea about my error?? . Skipping book_log-20060222T143612.txt Skipping

[R] Repeated values

2009-03-11 Thread Tammy Ma
Hi,All. How to make a program to delete repeated value? a example c [1] 4 3 0 3 4 1 0 1 4 4 3 4 3 4 I want to get : 4 3 0 3 4 1 0 1 4 3 4 3 4 two 4 is being represented by one 4. Thanks. Tammy _ More than messages–check out

[R] Date frame

2009-03-11 Thread Tammy Ma
Hi, All, How to make a data frame, each row of data frame store the different length of vector? Thanks. Tammy _ Show them the way! Add maps and directions to your party invites.

Re: [R] Date frame

2009-03-11 Thread Tammy Ma
. Tammy Date: Wed, 11 Mar 2009 07:50:37 -0400 Subject: Re: [R] Date frame From: jholt...@gmail.com To: metal_lical...@live.com CC: r-help@r-project.org It is called a list. On Wed, Mar 11, 2009 at 6:32 AM, Tammy Ma metal_lical...@live.com wrote: Hi, All, How to make a data frame

Re: [R] How to monthly,daily,yearly average

2009-03-11 Thread Tammy Ma
Check as.Date Date: Wed, 11 Mar 2009 06:25:44 -0700 From: qflic...@yahoo.com To: r-help@r-project.org Subject: [R] How to monthly,daily,yearly average Sorry, this is my first time to post. I have a big data set: first colume is date (ex: 2008-2-150, the second is time (10:30:00),

[R] About the merge

2009-03-11 Thread Tammy Ma
hi, All. DateDtime Hour Min Second Rep App_dur 9 2006-02-22 14:36:11 14 36 11 4 1 10 2006-02-22 14:36:12 14 36 12 3 86 11 2006-02-22 14:37:38 14 37 38 0 58 14 2006-02-22 14:38:36 14 38 36 3 1 15 2006-02-22 14:38:37 14 38