[R] Boxplot Labels solved
Hi Jose, Thanks a lot for your email! I was told a good solution to label outliers of a boxplot with identifying variable values of the data frame (instead of the row names). An example can be seen below: ## R CODE #DATA num <- as.numeric(200:225) ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 7.2, 4, 4.8, 3.5, 2.7, 3.1, 2.8, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7) DATA <- data.frame(cbind(num, ave)) rm(num, ave) #BOXPLOT x11() bp <- boxplot(DATA$ave, data= DATA, main= "Average Size") identify(rep(1, nrow(DATA)), DATA$ave, labels=DATA$num, cex=.7) Bea -Original Message- From: Jose Iparraguirre Sent: Wednesday, April 10, 2013 10:19 AM To: Beatriz González Domínguez ; r-help-ow...@r-project.org ; R Help 1 ; R Help 2 Subject: RE: [R] Boxplot Labels OK Beatriz, In this case, use the car package and run the following: bp <- Boxplot(DATA$ave, data= DATA, main= "Average Size", labels=DATA$num, Id.method=c("y")) This will print out the labels 211 & 225 beside the outlier points. As you can see, the instruction assigns the values in the num column in the DATA data frame to the labels. If you prefer the interactive option, replace id.method=c("y") with id.method=c("identify") Kind regards, José José Iparraguirre Chief Economist Age UK T 020 303 31482 E jose.iparragui...@ageuk.org.uk Twitter @jose.iparraguirre@ageuk Tavis House, 1- 6 Tavistock Square London, WC1H 9NB www.ageuk.org.uk | ageukblog.org.uk | @ageukcampaigns -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Beatriz González Domínguez Sent: 09 April 2013 17:32 To: r-help-ow...@r-project.org; R Help 1; R Help 2 Subject: [R] Boxplot Labels OK Dear all, I have just sent an enquiry but probably I hadn’t expressed myself properly. Could anyone help me with the following? When I run the code on my data I get a boxplot with outliers identified by numbers 200 & 201. However, what I would like is to label these outliers with their corresponding “DATA$numâ€? values of the data frame. In this example, the outliers should be labelled as: 211 & 225 Do you have any idea of how I could do this? Please, if you need any more details just get in touch. Many thanks in advance! ## R CODE #DATA num <- as.numeric(200:225) ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 7.2, 4, 4.8, 3.5, 2.7, 3.1, 2.8, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7) DATA <- data.frame(cbind(num, ave)) rm(num, ave) #BOXPLOT x11() bp <- boxplot(DATA$ave, data= DATA, main= "Average Size") identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7) Bea [[alternative HTML version deleted]] Please donate to the Syria Crisis Appeal by text or online: To donate £5 by mobile, text SYRIA to 70800. To donate online, please visit http://www.ageinternational.org.uk/syria Over one million refugees are desperately in need of water, food, healthcare, warm clothing, blankets and shelter; Age International urgently needs your support to help affected older refugees. Age International is a subsidiary charity of Age UK and a member of the Disasters Emergency Committee (DEC). The DEC launches and co-ordinates national fundraising appeals for public donations on behalf of its member agencies. Texts cost £5 plus one standard rate message. Age International will receive a minimum of £4.96. More info at ageinternational.org.uk/SyriaTerms --- Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798). Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA. For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited, Age UK is an Introducer Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth Access for the purposes of introducing potential annuity and health cash plans customers respectively. Age UK Enterprises Limited, JLT Benefit Solutions Limited and Simplyhealth Access are all authorised and regulated by the Financial Services Authority. -- This email and any files transmitted with it are confide...{{dropped:27}} __ R-help@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.
[R] Boxplot Labels OK
Dear all, I have just sent an enquiry but probably I hadnât expressed myself properly. Could anyone help me with the following? When I run the code on my data I get a boxplot with outliers identified by numbers 200 & 201. However, what I would like is to label these outliers with their corresponding âDATA$numâ values of the data frame. In this example, the outliers should be labelled as: 211 & 225 Do you have any idea of how I could do this? Please, if you need any more details just get in touch. Many thanks in advance! ## R CODE #DATA num <- as.numeric(200:225) ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 7.2, 4, 4.8, 3.5, 2.7, 3.1, 2.8, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7) DATA <- data.frame(cbind(num, ave)) rm(num, ave) #BOXPLOT x11() bp <- boxplot(DATA$ave, data= DATA, main= "Average Size") identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7) Bea [[alternative HTML version deleted]] __ R-help@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.
[R] Boxplot Labels
#Dear all, #Could anyone help me with the following? #DATA num <- as.numeric(seq(100:125)) ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 4, 4.8, 3.5, 2.7, 3.1, 2.8, 3.5, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7) DATA <- data.frame(cbind(num, ave)) rm(num, ave) #BOXPLOT x11() bp <- boxplot(DATA$ave, data= DATA, main= "Average Size") identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7) #I would like the labels that appear in the boxplot to be DATA$num values. #When I identify the outlier it appears a "1" when I would like to appear a "26" #Do you have any idea of how I could do that? #Many thanks! #Bea [[alternative HTML version deleted]] __ R-help@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.
[R] Boxplot Labels
#Dear all, #Could anyone help me with the following? #DATA num <- as.numeric(seq(100:125)) ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 4, 4.8, 3.5, 2.7, 3.1, 2.8, 3.5, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7) DATA <- data.frame(cbind(num, ave)) rm(num, ave) #BOXPLOT x11() bp <- boxplot(DATA$ave, data= DATA, main= "Average Size") identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7) #I would like the labels that appear in the boxplot to be DATA$num values. #When I identify the outlier it appears a "1" when I would like to appear a "26" #Do you have any idea of how I could do that? #Many thanks! #Bea [[alternative HTML version deleted]] __ R-help@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.
[R] Remove a row containing a specific value for a column
Dear all, Could anyone help me with the following? DATA <- data.frame(rbind(c("Red1", 1, 1, 1), c("Blue1", 1, 1, 1), c("Red2", 1, 1, 1), c("Red3", 1, 1, 1))) colnames(DATA) <- c("A", "B","C", "D") #Option 1 DATA <- DATA[-2, ] #Same result I would like to achieve with Option 2 #Option 2 - I would like to do it in this way. Do you know how it could be done? #DATA <- THE CODE WOULD SAY (Remove the row which contains the value "Blue1" in column "A") Many thanks! Bea [[alternative HTML version deleted]] __ R-help@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.
[R] Data normalization
Dear all, Iâm finding difficulties to normalize this data. Could you provide some input? DATA: c(0.000103113, 0.000102948, 0.000104001, 0.000103794, 0.000104628, 9.2765e-05, 9.4296e-05, 9.5025e-05, 9.4978e-05, 9.8821e-05, 9.7586e-05, 9.6285e-05, 0.00010158, 0.000100919, 0.000103535, 0.000103321, 0.000102842, 0.000102315, 0.0001033, 0.000103691, 0.000102689, 0.000103248, 0.000101216, 0.000103127, 0.000103439, 0.000102818, 0.000103482, 0.00010227, 0.000104264, 0.000104672, 0.000104586, 0.000104516, 0.000104585, 0.000103804, 0.000103702, 0.000103405, 0.000104815, 0.000101718, 0.000101792, 0.000103273, 0.000102942, 0.000102522, 0.000103149, 0.0001036995, 0.0001039735, 0.0001014877, 0.000102796) Greatly appreciated!! [[alternative HTML version deleted]] __ R-help@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.
[R] Fw: Reversing data transformation
From: aguitatie...@hotmail.com Sent: Friday, April 05, 2013 11:47 PM To: r-help@r-project.org ; R Help Subject: Reversing data transformation Hi everybody, I would be very grateful if you could give me your thoughts on the following issue. I need to perform Box-Cox (bcPowerÂÂ) transformation on my data. To do this, I calculated lambda using the function 'ÂÂpowerTransform'ÂÂ. powerTransform(data) However, I got an error message when performing this function: Convergence failure: return code = 52 I was told by John Fox that the nature of my data was probably causing the problem so I applied the following transformation: powerTransform(1e7*(data - 0.99*(min(data [1] And it worked! However, now when I try to check the normality of my data, shapiro.test(data) I get a new warning message: Error in shapiro.test(data) : ifault=6. This should not happen I think this may be solved by removing the transformation I applied previously in [1], but Iâm not sure how to do it properly. Could anyone give me some advice? MY DATA: c(0.000103113, 0.000102948, 0.000104001, 0.000103794, 0.000104628, 9.2765e-05, 9.4296e-05, 9.5025e-05, 9.4978e-05, 9.8821e-05, 9.7586e-05, 9.6285e-05, 0.00010158, 0.000100919, 0.000103535, 0.000103321, 0.000102842, 0.000102315, 0.0001033, 0.000103691, 0.000102689, 0.000103248, 0.000101216, 0.000103127, 0.000103439, 0.000102818, 0.000103482, 0.00010227, 0.000104264, 0.000104672, 0.000104586, 0.000104516, 0.000104585, 0.000103804, 0.000103702, 0.000103405, 0.000104815, 0.000101718, 0.000101792, 0.000103273, 0.000102942, 0.000102522, 0.000103149, 0.0001036995, 0.0001039735, 0.0001014877, 0.000102796) Thanks a lot!! Bea [[alternative HTML version deleted]] __ R-help@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.
[R] Reversing data transformation
Hi everybody, I would be very grateful if you could give me your thoughts on the following issue. I need to perform Box-Cox (bcPowerÂÂ) transformation on my data. To do this, I calculated lambda using the function 'ÂÂpowerTransform'ÂÂ. powerTransform(data) However, I got an error message when performing this function: Convergence failure: return code = 52 I was told by John Fox that the nature of my data was probably causing the problem so I applied the following transformation: powerTransform(1e7*(data - 0.99*(min(data [1] And it worked! However, now when I try to check the normality of my data, shapiro.test(data) I get a new warning message: Error in shapiro.test(data) : ifault=6. This should not happen I think this may be solved by removing the transformation I applied previously in [1], but Iâm not sure how to do it properly. Could anyone give me some advice? MY DATA: c(0.000103113, 0.000102948, 0.000104001, 0.000103794, 0.000104628, 9.2765e-05, 9.4296e-05, 9.5025e-05, 9.4978e-05, 9.8821e-05, 9.7586e-05, 9.6285e-05, 0.00010158, 0.000100919, 0.000103535, 0.000103321, 0.000102842, 0.000102315, 0.0001033, 0.000103691, 0.000102689, 0.000103248, 0.000101216, 0.000103127, 0.000103439, 0.000102818, 0.000103482, 0.00010227, 0.000104264, 0.000104672, 0.000104586, 0.000104516, 0.000104585, 0.000103804, 0.000103702, 0.000103405, 0.000104815, 0.000101718, 0.000101792, 0.000103273, 0.000102942, 0.000102522, 0.000103149, 0.0001036995, 0.0001039735, 0.0001014877, 0.000102796) Thanks a lot!! Bea [[alternative HTML version deleted]] __ R-help@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.
[R] Regression line does not show on scatterplot
Hello, I have done a scatterplot and now would like to add its regression line but it does not show. Below, the code I have used. lm3 <- lm(data$S_pH_KCl2.5_BCx~data$B_OleicoPF_BCx_per) plot(data$S_pH_KCl2.5_BCx, data$B_OleicoPF_BCx_per) abline(lm3) I have been able to do the complete operation using the software STATISTICA but it would be great to do it with R. If you require more details please get in touch. Thanks a lot! Bea [[alternative HTML version deleted]] __ R-help@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.