Re: [R] suggestion for analysis ....MANOVA ?
up up up .. ychu066 wrote: Hi eveyone, I am currently working with a porject which requires me to compare 6 profiles which have 146 response variables . . . where profile one, two and three are tested on the same day say Day1 but ptofile five and six are on different days say Day2 and Day3. I have two research question 1.Are profile within day the same/stable? 2.Are profile across days the same/stable? Therefore , I was about to use a MANOVA but I dunno how to fit it ... or should I give another statistical method to analysis the data The data is also attached, please really take a look THANKS http://n4.nabble.com/file/n947342/HELP.csv HELP.csv -- View this message in context: http://n4.nabble.com/suggestion-for-analysis-MANOVA-tp947342p948162.html Sent from the R help mailing list archive at Nabble.com. __ 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] suggestion for analysis ....MANOVA ?
Hi eveyone, I am currently working with a porject which requires me to compare 6 profiles which have 146 response variables . . . where profile one, two and three are tested on the same day say Day1 but ptofile five and six are on different days say Day2 and Day3. I have two research question 1. Are profile within day the same/stable? 2. Are profile across days the same/stable? Therefore , I was about to use a MANOVA but I dunno how to fit it ... or should I give another statistical method to analysis the data The data is also attached, please really take a look THANKS http://n4.nabble.com/file/n947342/HELP.csv HELP.csv -- View this message in context: http://n4.nabble.com/suggestion-for-analysis-MANOVA-tp947342p947342.html Sent from the R help mailing list archive at Nabble.com. __ 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] Splitting the Distribution
Hi all, I am wondering if R can split the distribution respect to the median ? I know it can be done in SAS. http://old.nabble.com/file/p26535862/Normal.bmp Normal.bmp ?? -- View this message in context: http://old.nabble.com/Splitting-the-Distribution-tp26535862p26535862.html Sent from the R help mailing list archive at Nabble.com. __ 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] Multivariate problems . . . with 200 resposes variables and 1 explanatory variable
How should I analysis it in R all the resposes variables are ordinal from 0 to 10. and the explanatory variable is a factor ... -- View this message in context: http://old.nabble.com/Multivariate-problems-.-.-.-with-200-resposes-variables-and-1-explanatory-variable-tp26522912p26522912.html Sent from the R help mailing list archive at Nabble.com. __ 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] Adding text in the panels for Trellis plot ...
i was trying to do a for loop for plotting the histograms , but it doesnt work properly library(lattice) columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) + { + plots[[ j - j+1 ]] - histogram( ~ data[,i] | data[,2],ylab = Frequency, + xlab = Score, xlim = c(1,5), ylim = c(0,100),layout=c(3,1), + main = c(colnames(data)[i],index,j+1),mycolors = colors()[c(536,552,652,254,26)], + panel = function(..., col, mycolors) { + panel.histogram(..., col = mycolors[panel.number()])}) + trellis.focus('strip', 1, 1, highlight=FALSE) + ltext(0.60, -0.25, 'PPM', col='blue', pos=3) + trellis.unfocus() + } Error in grid.Call.graphics(L_downviewport, name$name, strict) : Viewport 'plot1.strip.1.1.vp' was not found print(plots[[1]]) I am not sure what was happeneing. . . can anyone help me ? -- View this message in context: http://old.nabble.com/Adding-text-in-the-panels-for-Trellis-plot-...-tp26522902p26522902.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Trellis Plot
i was trying to do a for loop for plotting the histograms , but it doesnt work properly library(lattice) columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) + { + plots[[ j - j+1 ]] - histogram( ~ data[,i] | data[,2],ylab = Frequency, + xlab = Score, xlim = c(1,5), ylim = c(0,100),layout=c(3,1), + main = c(colnames(data)[i],index,j+1),mycolors = colors()[c(536,552,652,254,26)], + panel = function(..., col, mycolors) { + panel.histogram(..., col = mycolors[panel.number()])}) + trellis.focus('strip', 1, 1, highlight=FALSE) + ltext(0.60, -0.25, 'PPM', col='blue', pos=3) + trellis.unfocus() + } Error in grid.Call.graphics(L_downviewport, name$name, strict) : Viewport 'plot1.strip.1.1.vp' was not found print(plots[[1]]) I am not sure what was happeneing. . . can anyone help me ? ychu066 wrote: anyone know how to add text in the Trellis plot panel ?? i want to add things eg: dot dot dot. in the headrer of the panel. eg: http://old.nabble.com/file/p26486579/hist1.png hist1.png -- View this message in context: http://old.nabble.com/Trellis-Plot-tp26486579p26505934.html Sent from the R help mailing list archive at Nabble.com. __ 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] Translation from R codes to SAS.
my teachers doesnt understand R and I don't know how to use SAS. Anyone interested in translating my codes to test whether your SAS codes are as good as R??? I can test it on SAS codes once you have translated it regards:working: -- View this message in context: http://old.nabble.com/Translation-from-R-codes-to-SAS.-tp26486117p26486117.html Sent from the R help mailing list archive at Nabble.com. __ 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] Trellis Plot
anyone know how to add text in the Trellis plot panel ?? i want to add things eg: dot dot dot. in the headrer of the panel. eg: http://old.nabble.com/file/p26486579/hist1.png hist1.png -- View this message in context: http://old.nabble.com/Trellis-Plot-tp26486579p26486579.html Sent from the R help mailing list archive at Nabble.com. __ 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] any equivalent SUM IF statement in R
for example, i want to sum all the row entries if column 1 takes the value boy. anyone knows ? -- View this message in context: http://old.nabble.com/any-equivalent-SUM-IF-statement-in-R-tp26467889p26467889.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
NICE!!! thanks Deepayan Sarkar wrote: On Thu, Nov 19, 2009 at 6:03 AM, ychu066 ychu...@aucklanduni.ac.nz wrote: http://old.nabble.com/file/p26418382/hist1.png hist1.png i want three plots along on the side , how to i do that ? and I also want to change the colour of the bars for each plot, how do i do that ? i got the code here to draw that .. This code did not produce the plot you have linked to. The answer to your question depends on how you created the plot, so you have to tell us that. Changing the color in all panels is easy: histogram(rnorm(100), col = goldenrod) Different colors in different panels is a little more work: histogram(~rnorm(100) | gl(3, 1, 100), mycolors = sample(colors(), 3), panel = function(..., col, mycolors) { panel.histogram(..., col = mycolors[panel.number()]) }) -Deepayan columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) { plots[[ j - j+1 ]] - histogram( ~ data[,i], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100), main = colnames(data)[i] ) } print(plots[[1]]) # or export for (i in seq_along(plots)) { png(paste(hist, i, .png, sep = )) print(plots[[i]]) dev.off() } -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26418382.html Sent from the R help mailing list archive at Nabble.com. __ 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-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. -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26471627.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
anyone know how to add some text on the panel ??? for example 2.5, 50 and 1000 are mearsured in Litre, and i want to put the units beside the measurements. How could i do that? ychu066 wrote: NICE!!! thanks Deepayan Sarkar wrote: On Thu, Nov 19, 2009 at 6:03 AM, ychu066 ychu...@aucklanduni.ac.nz wrote: http://old.nabble.com/file/p26418382/hist1.png hist1.png i want three plots along on the side , how to i do that ? and I also want to change the colour of the bars for each plot, how do i do that ? i got the code here to draw that .. This code did not produce the plot you have linked to. The answer to your question depends on how you created the plot, so you have to tell us that. Changing the color in all panels is easy: histogram(rnorm(100), col = goldenrod) Different colors in different panels is a little more work: histogram(~rnorm(100) | gl(3, 1, 100), mycolors = sample(colors(), 3), panel = function(..., col, mycolors) { panel.histogram(..., col = mycolors[panel.number()]) }) -Deepayan columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) { plots[[ j - j+1 ]] - histogram( ~ data[,i], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100), main = colnames(data)[i] ) } print(plots[[1]]) # or export for (i in seq_along(plots)) { png(paste(hist, i, .png, sep = )) print(plots[[i]]) dev.off() } -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26418382.html Sent from the R help mailing list archive at Nabble.com. __ 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-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. http://old.nabble.com/file/p26471713/hist1.png hist1.png -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26471713.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
what is that ? Hrishi Mittal wrote: Add col=i in the histogram call. -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26421453.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
Fore example my code is histogram(~data[,8]|data[,2], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100),layout = c(3,1),col=data[,2] ) and i want the colour to be depended on the level of the factor in data[,2]. how do i do that ? ychu066 wrote: what is that ? Hrishi Mittal wrote: Add col=i in the histogram call. -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26421461.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
I want to change the colour of the histogram in each panel by the levels of the conoditonal factor. I have 3 levels in the factor levels(data[,2])[1] levels(data[,2])[2] levels(data[,2])[3] what can i do , in order to chnage the colour ?? ychu066 wrote: Fore example my code is histogram(~data[,8]|data[,2], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100),layout = c(3,1),col=data[,2] ) and i want the colour to be depended on the level of the factor in data[,2]. how do i do that ? ychu066 wrote: what is that ? Hrishi Mittal wrote: Add col=i in the histogram call. -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26421465.html Sent from the R help mailing list archive at Nabble.com. __ 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] RE shaping large dataset
I am doing a project which involve reshaping a large dataset, can any of you please sugguest me some good reading/websites/ examples can be in R and SAS Thanks everyone !!! -- View this message in context: http://old.nabble.com/REshaping-large-dataset-tp26421513p26421513.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
I AM REALLY LOST . ychu066 wrote: I want to change the colour of the histogram in each panel by the levels of the conoditonal factor. I have 3 levels in the factor levels(data[,2])[1] levels(data[,2])[2] levels(data[,2])[3] what can i do , in order to chnage the colour ?? ychu066 wrote: Fore example my code is histogram(~data[,8]|data[,2], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100),layout = c(3,1),col=data[,2] ) and i want the colour to be depended on the level of the factor in data[,2]. how do i do that ? ychu066 wrote: what is that ? Hrishi Mittal wrote: Add col=i in the histogram call. %-|%-|%-|%-|%-|%-|%-| -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26422110.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] re placing the dates format in R for exporting the data set...
Ok thanks jholtman wrote: ?write.table If you read the help file, and do a little experimenting, you will see that there is a parameter 'rownames=FALSE' that may answer your question. Also since you did not have column names on your input, you get V1, V2,... You can put your own column names. It helps again to read the help file on 'read.table' and look at the parameter 'col.names'. There is also the colnames function. It also might help to (re)read the Intro to R. On Tue, Nov 17, 2009 at 8:27 PM, ychu066 ychu...@aucklanduni.ac.nz wrote: Moreover, I want to rename the column name V1,V2,V3,V4.V146. how do i write the code in R ??? thanks everyone that look at the thread/ ychu066 wrote: hi everyone, i am having difficulties with replacing the dates format in R for exporting the data set... eg: the code that i used was toms_dat- replace(toms_dat, toms_dat ==2009-08-06, 2) toms_dat- replace(toms_dat, toms_dat ==2009-08-04, 1) but when i export the data as into txt file or excel file the dates come up with very large numbers .:drunk: please help me ...=) http://old.nabble.com/file/p26400792/what.csv what.csv -- View this message in context: http://old.nabble.com/replacing-the-dates-format-in-R-for-exporting-the-data-set...-tp26396492p26400792.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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. -- View this message in context: http://old.nabble.com/replacing-the-dates-format-in-R-for-exporting-the-data-set...-tp26396492p26418090.html Sent from the R help mailing list archive at Nabble.com. __ 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] How do I change the colour and format for the trelli plot ?
http://old.nabble.com/file/p26418382/hist1.png hist1.png i want three plots along on the side , how to i do that ? and I also want to change the colour of the bars for each plot, how do i do that ? i got the code here to draw that .. columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) { plots[[ j - j+1 ]] - histogram( ~ data[,i], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100), main = colnames(data)[i] ) } print(plots[[1]]) # or export for (i in seq_along(plots)) { png(paste(hist, i, .png, sep = )) print(plots[[i]]) dev.off() } -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26418382.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] HOw to delete a row in the data matrix and change the order of the row ???
done thanks Uwe Ligges-3 wrote: Assign new row names? Uwe Ligges ychu066 wrote: hi, i delete row 65,70,75 in my data data- data[-c(65,70,75),] But i also want the order of the row to match up eg: 67 1111111111111 1 1 68 1111111111111 1 1 69 1111111111111 1 1 71 1111111111111 1 1 72 1111111111111 1 1 73 1111111111111 1 1 74 1111111111111 1 1 76 1111111111111 1 1 77 1111111111111 1 1 I dont want this , I don't want a gap between 69-71 , 73-74 and 74-76. i want it like this 67 1111111111111 1 1 68 1111111111111 1 1 69 1111111111111 1 1 70 1111111111111 1 1 71 1111111111111 1 1 72 1111111111111 1 1 73 1111111111111 1 1 74 1111111111111 1 1 75 1111111111111 1 1 please help me ... __ 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. -- View this message in context: http://old.nabble.com/HOw-to-delete-a-row-in-the-data-matrix-and-change-the-order-of-the-row-tp26401860p26419345.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
I have solved the first problem by using layout=c(1,3) but still cant find the solution for the next problem of getting differenct colour for the bars in the 3 different histogram plots ychu066 wrote: http://old.nabble.com/file/p26418382/hist1.png hist1.png i want three plots along on the side , how to i do that ? and I also want to change the colour of the bars for each plot, how do i do that ? i got the code here to draw that .. columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) { plots[[ j - j+1 ]] - histogram( ~ data[,i], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100), main = colnames(data)[i] ) } print(plots[[1]]) # or export for (i in seq_along(plots)) { png(paste(hist, i, .png, sep = )) print(plots[[i]]) dev.off() } -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26419007.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] re placing the dates format in R for exporting the data set...
hey Jim , I have solve the column name problems now. But i am still unable to read the date in R ... toms_dat- replace(toms_dat, toms_dat ==2009-08-24, 6) the toms_dat is a data frame , and I want to replace the date to be a single number eg:1,2,3, regards, Tom. jholtman wrote: First of all '2009-08-06' is 1995; this is probably not what you were expecting. What do you what your expression to do? Is 'toms_dat' a dataframe? if so, your expression 'toms_dat ==2009-08-06' seem strange. So tell us what you want to do, not how you want to do it. On Tue, Nov 17, 2009 at 4:54 PM, ychu066 ychu...@aucklanduni.ac.nz wrote: hi everyone, i am having difficulties with replacing the dates format in R for exporting the data set... eg: the code that i used was toms_dat- replace(toms_dat, toms_dat ==2009-08-06, 2) toms_dat- replace(toms_dat, toms_dat ==2009-08-04, 1) but when i export the data as into txt file or excel file the dates come up with very large numbers .:drunk: please help me ...=) -- View this message in context: http://old.nabble.com/replacing-the-dates-format-in-R-for-exporting-the-data-set...-tp26396492p26396492.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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. -- View this message in context: http://old.nabble.com/replacing-the-dates-format-in-R-for-exporting-the-data-set...-tp26396492p26420068.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] How do I change the colour and format for the trelli plot ?
tried reading the help(histogram) but didnt fiind it helpful ychu066 wrote: I have solved the first problem by using layout=c(1,3) but still cant find the solution for the next problem of getting differenct colour for the bars in the 3 different histogram plots ychu066 wrote: http://old.nabble.com/file/p26418382/hist1.png hist1.png i want three plots along on the side , how to i do that ? and I also want to change the colour of the bars for each plot, how do i do that ? i got the code here to draw that .. columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) { plots[[ j - j+1 ]] - histogram( ~ data[,i], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100), main = colnames(data)[i] ) } print(plots[[1]]) # or export for (i in seq_along(plots)) { png(paste(hist, i, .png, sep = )) print(plots[[i]]) dev.off() } -- View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26419023.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
tried but still doesnt work ... very weird ... ychu066 wrote: here is the codes that i tried. png(paste(hist,i,.png,sep=) + library(lattice) Error: unexpected symbol in: png(paste(hist,i,.png,sep=) library for(i in 8:153){ + histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) Error: unexpected ')' in: for(i in 8:153){ histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) } Error: unexpected '}' in } dev.off() Error in dev.off() : cannot shut down device 1 (the null device) ychu066 wrote: still doesnt work ... Karl Ove Hufthammer wrote: On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 ychu066 @aucklanduni.ac.nz wrote: And I also want to save each histogram in each separate pdf file using the following codes ?. png(hist.png[i]) dev.off() Try png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer __ 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. -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26384489.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP
THANKS EVERYONE, IT WORKS NOW !!! BY THE WAY, i want to improve my R coding skills, any suggestion for me ? Colin Millar wrote: Or alternatively store as a list and export later if you want ... after some tidying ... library(lattice) columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) { plots[[ j - j+1 ]] - histogram( ~ data[,i] | data[,2], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100), main = colnames(data)[i] ) } print(plots[[1]]) # or export for (i in seq_along(plots)) { png(paste(hist, i, .png, sep = )) print(plots[[i]]) dev.off() } HTH Colin. Incidentally, You put what you want to export between png(..) and dev.off() If you supply the data explicitly it doesn't make any sense to pass the data through the data argument. No need for paste(x) if is x is already a character vector. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tal Galili Sent: 17 November 2009 12:15 To: ychu066 Cc: r-help@r-project.org Subject: Re: [R] Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP I know how you feel, I came a cross the same problem once, which took sometime to find a solution for. What you need to do is put the hist into a variable and then plot it, for example: library(lattice) for(i in 8:153){ hist.to.plot - histogram(~ data[,i] | data[,2], data=data,,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)),main =paste(colnames(data)[i],sep=) plot(hist.to.plot) } Cheers, Tal -- My contact information: Tal Galili E-mail: tal.gal...@gmail.com Phone number: 972-52-7275845 FaceBook: Tal Galili My Blogs: http://www.talgalili.com (Web and general, Hebrew) http://www.biostatistics.co.il (Statistics, Hebrew) http://www.r-statistics.com/ (Statistics,R, English) On Tue, Nov 17, 2009 at 7:09 AM, ychu066 ychu...@aucklanduni.ac.nz wrote: tried but still doesnt work ... very weird ... ychu066 wrote: here is the codes that i tried. png(paste(hist,i,.png,sep=) + library(lattice) Error: unexpected symbol in: png(paste(hist,i,.png,sep=) library for(i in 8:153){ + histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) Error: unexpected ')' in: for(i in 8:153){ histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) } Error: unexpected '}' in } dev.off() Error in dev.off() : cannot shut down device 1 (the null device) ychu066 wrote: still doesnt work ... Karl Ove Hufthammer wrote: On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 ychu066 @aucklanduni.ac.nz wrote: And I also want to save each histogram in each separate pdf file using the following codes ?. png(hist.png[i]) dev.off() Try png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer __ 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. -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-l oop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26 384489.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ 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. :working::working::working::working::working::working: -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP
[R] re placing the dates format in R for exporting the data set...
hi everyone, i am having difficulties with replacing the dates format in R for exporting the data set... eg: the code that i used was toms_dat- replace(toms_dat, toms_dat ==2009-08-06, 2) toms_dat- replace(toms_dat, toms_dat ==2009-08-04, 1) but when i export the data as into txt file or excel file the dates come up with very large numbers .:drunk: please help me ...=) -- View this message in context: http://old.nabble.com/replacing-the-dates-format-in-R-for-exporting-the-data-set...-tp26396492p26396492.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] re placing the dates format in R for exporting the data set...
moreover, how come when I export a dataframe out from R say, it become a excel file. The first column includes the inex number eg: 1,2,3 ..n instead of including the values that the first column should be have anyone know how to solve this problem ? ychu066 wrote: hi everyone, i am having difficulties with replacing the dates format in R for exporting the data set... eg: the code that i used was toms_dat- replace(toms_dat, toms_dat ==2009-08-06, 2) toms_dat- replace(toms_dat, toms_dat ==2009-08-04, 1) but when i export the data as into txt file or excel file the dates come up with very large numbers .:drunk: please help me ...=) -- View this message in context: http://old.nabble.com/replacing-the-dates-format-in-R-for-exporting-the-data-set...-tp26396492p26400287.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP
Hi again, do you know how can I use the main function to change the title for eac h histogram. i.e that first graph show have a title Index 1 but because the variable name column starts the 8th the title shows up as Index 8 , i have tried use main = colnames(data)[i-1] but it result errors Colin Millar wrote: Or alternatively store as a list and export later if you want ... after some tidying ... library(lattice) columns - 8:153 plots - vector(list, length(columns)) j - 0 for (i in columns) { plots[[ j - j+1 ]] - histogram( ~ data[,i] | data[,2], ylab = Frequency, xlab = Score, xlim = c(1,5), ylim = c(0,100), main = colnames(data)[i] ) } print(plots[[1]]) # or export for (i in seq_along(plots)) { png(paste(hist, i, .png, sep = )) print(plots[[i]]) dev.off() } HTH Colin. Incidentally, You put what you want to export between png(..) and dev.off() If you supply the data explicitly it doesn't make any sense to pass the data through the data argument. No need for paste(x) if is x is already a character vector. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tal Galili Sent: 17 November 2009 12:15 To: ychu066 Cc: r-help@r-project.org Subject: Re: [R] Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP I know how you feel, I came a cross the same problem once, which took sometime to find a solution for. What you need to do is put the hist into a variable and then plot it, for example: library(lattice) for(i in 8:153){ hist.to.plot - histogram(~ data[,i] | data[,2], data=data,,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)),main =paste(colnames(data)[i],sep=) plot(hist.to.plot) } Cheers, Tal -- My contact information: Tal Galili E-mail: tal.gal...@gmail.com Phone number: 972-52-7275845 FaceBook: Tal Galili My Blogs: http://www.talgalili.com (Web and general, Hebrew) http://www.biostatistics.co.il (Statistics, Hebrew) http://www.r-statistics.com/ (Statistics,R, English) On Tue, Nov 17, 2009 at 7:09 AM, ychu066 ychu...@aucklanduni.ac.nz wrote: tried but still doesnt work ... very weird ... ychu066 wrote: here is the codes that i tried. png(paste(hist,i,.png,sep=) + library(lattice) Error: unexpected symbol in: png(paste(hist,i,.png,sep=) library for(i in 8:153){ + histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) Error: unexpected ')' in: for(i in 8:153){ histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) } Error: unexpected '}' in } dev.off() Error in dev.off() : cannot shut down device 1 (the null device) ychu066 wrote: still doesnt work ... Karl Ove Hufthammer wrote: On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 ychu066 @aucklanduni.ac.nz wrote: And I also want to save each histogram in each separate pdf file using the following codes ?. png(hist.png[i]) dev.off() Try png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer __ 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. -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-l oop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26 384489.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ 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. -- View this message in context: http
Re: [R] re placing the dates format in R for exporting the data set...
Moreover, I want to rename the column name V1,V2,V3,V4.V146. how do i write the code in R ??? thanks everyone that look at the thread/ ychu066 wrote: hi everyone, i am having difficulties with replacing the dates format in R for exporting the data set... eg: the code that i used was toms_dat- replace(toms_dat, toms_dat ==2009-08-06, 2) toms_dat- replace(toms_dat, toms_dat ==2009-08-04, 1) but when i export the data as into txt file or excel file the dates come up with very large numbers .:drunk: please help me ...=) http://old.nabble.com/file/p26400792/what.csv what.csv -- View this message in context: http://old.nabble.com/replacing-the-dates-format-in-R-for-exporting-the-data-set...-tp26396492p26400792.html Sent from the R help mailing list archive at Nabble.com. __ 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] HOw to delete a row in the data matrix and change the order of the row ???
hi, i delete row 65,70,75 in my data data- data[-c(65,70,75),] But i also want the order of the row to match up eg: 67 11111111111111 1 68 11111111111111 1 69 11111111111111 1 71 11111111111111 1 72 11111111111111 1 73 11111111111111 1 74 11111111111111 1 76 11111111111111 1 77 11111111111111 1 I dont want this , I don't want a gap between 69-71 , 73-74 and 74-76. i want it like this 67 11111111111111 1 68 11111111111111 1 69 11111111111111 1 70 11111111111111 1 71 11111111111111 1 72 11111111111111 1 73 11111111111111 1 74 11111111111111 1 75 11111111111111 1 please help me ... -- View this message in context: http://old.nabble.com/HOw-to-delete-a-row-in-the-data-matrix-and-change-the-order-of-the-row-tp26401860p26401860.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
still doesnt work ... Karl Ove Hufthammer wrote: On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 ychu066 @aucklanduni.ac.nz wrote: And I also want to save each histogram in each separate pdf file using the following codes ?. png(hist.png[i]) dev.off() Try png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer __ 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. -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26383915.html Sent from the R help mailing list archive at Nabble.com. __ 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] Plotting graphs using FOR loop
I have the following codes but can anyone make it shorter i.e making these FOR loop into one loop ... thanks... par(mfrow=c(2,4)) for(i in 16:23){ hist(data[,i],main=paste(colnames(data)[i],sep=),ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)) } png(histogram.png) dev.off() par(mfrow=c(2,4)) for(i in 24:31){ hist(data[,i],main=paste(colnames(data)[i],sep=),ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)) } png(histogram.png) dev.off() par(mfrow=c(2,4)) for(i in 32:39){ hist(data[,i],main=paste(colnames(data)[i],sep=),ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)) } png(histogram.png) dev.off() par(mfrow=c(2,4)) for(i in 40:47){ hist(data[,i],main=paste(colnames(data)[i],sep=),ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)) } png(histogram.png) dev.off() -- View this message in context: http://old.nabble.com/Plotting-graphs-using-FOR-loop-tp26383926p26383926.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
here is the codes that i tried. png(paste(hist,i,.png,sep=) + library(lattice) Error: unexpected symbol in: png(paste(hist,i,.png,sep=) library for(i in 8:153){ + histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) Error: unexpected ')' in: for(i in 8:153){ histogram(~ data[,i] | data[,2], data=data,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100))) } Error: unexpected '}' in } dev.off() Error in dev.off() : cannot shut down device 1 (the null device) ychu066 wrote: still doesnt work ... Karl Ove Hufthammer wrote: On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 ychu066 @aucklanduni.ac.nz wrote: And I also want to save each histogram in each separate pdf file using the following codes ?. png(hist.png[i]) dev.off() Try png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer __ 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. -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26384035.html Sent from the R help mailing list archive at Nabble.com. __ 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] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
I am trying to write R codes for the histogram plot and saving it out. There will be 146 histogram plots in total…. I have the following R codes that draws the each Histogram …. library(lattice) for(i in 8:153){ histogram(~ data[,i] | data[,2], data=data,,ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)),main=paste(colnames(data)[i],sep=) } And I also want to save each histogram in each separate pdf file using the following codes …. png(hist.png[i]) dev.off() But my R coding does NOT work …. I need someone to help me with this ……. Thanks million -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26328734.html Sent from the R help mailing list archive at Nabble.com. __ 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.