Re: [R] Opposite color in R
Hi Atte, If you look at the colors produced by rainbow(12): rainbow(12) [1] #FFFF #FF8000FF #00FF #80FF00FF #00FF00FF #00FF80FF [7] #00FF #0080 # #8000 #FF00 #FF0080FF they are complementary additive colors. That is, in the RGB color space, the colors at the opposite sides of the wheel would add to white (#FF) if mixed. The colors in the diagram you mentioned don't look like additive colors. Perhaps that diagram represents a subtractive (i.e. pigment) color space but based on the additive (red, green blue) primaries. Also remember that WYSINNWOPG (what you see is not necessarily what other people get) Jim On Sun, Jul 26, 2015 at 4:45 PM, ken knoblauch ken.knobla...@inserm.fr wrote: peter dalgaard pdalgd at gmail.com writes: On 25 Jul 2015, at 21:49 , Atte Tenkanen attenka at utu.fi wrote: Hi, I have tried to find a way to find opposite or complementary colors in R. I would like to form a color circle with R like this one: http://nobetty.net/dandls/ colorwheel/complementary_colors.jpg If you just make a basic color wheel in R, the colors do not form complementary color circle: palette(rainbow(24)) Colors=palette() pie(rep(1, 24), col = Colors) There is a package ”colortools” where you can find function opposite(), but it doesn’t work as is said. I tried library(colortools) opposite(violet) and got green instead of yellow and opposite(blue) and got yellow instead of orange. Do you know any solutions? Not directly, but a few hints: First read up on complementary colors in Wikipedia. In particular, note that the traditional color circle does not satisfy the modern definition of opposite-ness. E.g. red paint mixed with green paint is brown, not black or grey. The construction of the color circle is simple in principle: red, blue, yellow go at 0, 120, 240 degrees, the other colors on the circle are formed by mixing two primaries in varying proportions: green (at 180 deg) is an equal mixture of blue and yellow, violet (at 60 deg) of blue and red, orange (at 300 deg) of red and yellow. Blue-green (at 150 deg) would be half blue, half green, alias three quarter blue, one quarter yellow. Etc. The tricky bit is that the above mixtures are subtractive mixtures (mixing paint rather than light beams) and I don't know how to make a subtractive color mixture in the additive RGB space that we usually work in. Maybe there are tools in the colortools package? -pd Atte Tenkanen To start with, you should be specifying your colors or lights actually in an additive color space like CIE 1931 xy, https://en.wikipedia.org/wiki/CIE_1931_color_space which you can do in the colorspace package. But this is based on an average observer and the results are unlikely to match a given individual's vision. On top of that, decisions made when this norm was specified are such that it deviates from human vision for short wavelengths so that you would be better off using a corrected version like that proposed by Judd in the 1950's or for the most recent suggestion see ww.cvrl.org under New CIE XYZ functions transformed from the CIE (2006) LMS functions best, Ken -- Kenneth Knoblauch Inserm U846 Stem-cell and Brain Research Institute Department of Integrative Neurosciences 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.sbri.fr/members/kenneth-knoblauch.html __ R-help@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. __ R-help@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.
[R-es] error con librería earth
Hola a todos, Recientemente he cambiado de portátil (Windows 8.1). La instalación de la última versión de R me daba problemas al intentar ejecutar códigos que ya había utilizado en mi ordenador anterior (problemas relacionados con librerías). Por tanto, me decidí a desinstalar dicha versión e instalé la 3.0.0 ·Masked Marvel (2013-04-03). Nada más terminar, procedí a la instalación de la librería earth install.packages(earth) library(earth) La instaló sin problemas, pero al intentar ejecutar el código de ejemplo me sale el siguiente error, que era el que me salía con la última instalación de R: earth.mod - earth(Volume ~ ., data = trees) Error en plotmo::check.index(linpreds, linpreds, x, is.col.index = TRUE, : no se pudo encontrar la función anyNA ¿Alguien me podría dar una pista sobre dónde anda el problema? Un saludo y muchas gracias por vuestra ayuda, Fernando ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R] ggplot percent format for interest rates
Hi Glenn, I don't understand what you are after. If I run your code I get two figures to the right of the decimal point. Can you give us an example of the layout you want? Clearly I am missing the point. Note I removed the palate command from the code, ggplot(SwapCurve, aes(x = Tenor, y= Rate/100, colour = #E69F00)) + geom_line() + geom_line(size = 1.5) + ylab(Fixed Rate Payer Side) + xlab(Maturity (years)) + theme_minimal()+ theme(panel.grid.major = element_line(size = .25, color = grey)) + theme(axis.text = element_text(size = 15)) + theme(axis.title = element_text(size = 20)) + theme(legend.text=element_text(size= 15)) John Kane Kingston ON Canada -Original Message- From: glennmschu...@me.com Sent: Sat, 25 Jul 2015 22:52:07 + (GMT) To: r-help@r-project.org Subject: [R] ggplot percent format for interest rates Hello All, The data is as follows below with ggplot command. I would like there to be two digits to the right of the decimal on the y axis - this would be consistent with plotting interest rates. I have not had much luck. Any ideas are appreciated -glenn structure(list(Tenor = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30), Rate = c(0.226560966039639, 0.34, 0.44, 0.58, 0.79, 1.05, 1.30483402347606, 1.54, 1.7472935509309, 1.92899362434552, 2.09, 2.23452744367452, 2.36405066524527, 2.47935936061244, 2.58124322567624, 2.67049195633686, 2.7478952484945, 2.81424279804937, 2.87032430090165, 2.91692945295155, 2.95484795009927, 2.984869488245, 3.00778376328894, 3.0243804711313, 3.03544930767227, 3.04177996881204, 3.04416215045082, 3.04338554848881, 3.04023985882621, 3.0355147773632, 3.03)), .Names = c(Tenor, Rate), row.names = c(NA, -31L), class = data.frame) ggplot(SwapCurve, aes(x = Tenor, y= Rate/100, colour = #E69F00)) + geom_line() + geom_line(size = 1.5) + ylab(Fixed Rate Payer Side) + xlab(Maturity (years)) + theme_minimal()+ theme(panel.grid.major = element_line(size = .25, color = grey)) + scale_colour_manual(values = cbbPalette, guide = FALSE) + #scale_y_continuous(labels = percent)+ theme(axis.text = element_text(size = 15)) + theme(axis.title = element_text(size = 20)) + theme(legend.text=element_text(size= 15)) __ R-help@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. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ R-help@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.
Re: [R] Compute z
sum(v*w) There are no column vectors in R... there are vectors (that have no direction), and there are data frames that might only have one column, and matrices that might have many rows but only one column, and a piece of matrix or data frame is often converted to a vector when indexing is used to extract a column or row (e.g. mat[ , 1 ]). It may feel too dense to absorb at first, but the Introduction to R document that comes with R actually explains all this. Try (re)reading that occasionally until it sinks in. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On July 26, 2015 1:38:24 AM PDT, admin.dslcompu...@gmail.com wrote: Hi Everyone: How do I correctly compute z? z = 0; for i = 1:7 z = z + v(i) * w(i) end If there are two column vectors v and w, each with 7 elements (i.e., they have dimensions 7x1). Regards, Hal Sent from Surface [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
[R] Why I get the massage of Error in impacts.sarlm(s.lag, mat2listw(swmmat)) : Only row-standardised weights supported
Hi,all I am using the spdep-package to estimate the SAR(or called SLM) and SDM in R. I can get the estimation results of SAR and SDM with the command of lagsarlm. But when I perform the impact command to calculate the direct effect, indirect effect and total effect, it feedback the following sentences:Error in impacts.sarlm(s.lag, mat2listw(swmmat)) : Only row-standardised weights supported. I used the same matrix, whcih I built in ArcGIS 10.1 based on the principle of inversed distance with row standarised, and then it was converted into R. I have tried many times. Can you tell me what else I need to do to calculate the impacts and tell me the codes. Thank you so much! Best regards. Yours sincerely, Wenyue Yang *The codes I put into R is presented as follow:* v=read.csv(file=file.choose(),header=T) library(spdep) swm-read.table(file=file.choose(),header=T,sep=,)# I choose the text file of matrix built in ArcGIS n=length(unique(swm[[3]])) swmmat-matrix(0,n,n) apply(swm,1,function(x)swmmat[x[3],x[4]]-x[5]) setequal(swm$ID, v$ID) dimnames(swmmat)-list(v$ID,v$ID) swmmat-swmmat[v$ID,v$ID] fm=SJgap~BSD+MSD+RND s.lag-lagsarlm(fm,data=v,listw=mat2listw(swmmat)) impacts(s.lag, mat2listw(swmmat)) Error in impacts.sarlm(s.lag, mat2listw(swmmat)) : Only row-standardised weights supported OR W - as(mat2listw(swmmat), CsparseMatrix) trMatc - trW(W, type=mult) impacts(s.lag, trMatc) Error in impacts.sarlm(s.lag, trMatc) : Only row-standardised weights supported -- View this message in context: http://r.789695.n4.nabble.com/Why-I-get-the-massage-of-Error-in-impacts-sarlm-s-lag-mat2listw-swmmat-Only-row-standardised-weights-tp4710356.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R-es] error con librería earth
Hola Carlos, Muchas gracias por tu respuesta. Haciendo lo que me decías he logrado solucionar el problema. Sin embargo, me queda una duda: dado que al hacer library(earth), antes de la instalación de las librerías plotmo y plotrix me sale el siguiente mensaje: library(earth) Loading required package: plotmo Loading required package: plotrix Mensajes de aviso perdidos 1: package ‘earth’ was built under R version 3.0.3 2: package ‘plotmo’ was built under R version 3.0.3 3: package ‘plotrix’ was built under R version 3.0.3 ¿no se supone que ya las está instalando? Un saludo, Fernando De: Carlos Ortega [mailto:c...@qualityexcellence.es] Enviado el: domingo, 26 de julio de 2015 14:40 Para: Fernando Sanchez fernandsan...@yahoo.es CC: r-help-es@r-project.org Asunto: Re: [R-es] error con librería earth Hola, ¿ Has comprobado si tienes instaladas igualmente las librerías plotmo y plotrix?. El error que obtienes está asociado a la librería plotmo. Saludos, Carlos Ortega www.qualityexcellence.es El 26 de julio de 2015, 14:24, Fernando Sanchez fernandsan...@yahoo.es escribió: Hola a todos, Recientemente he cambiado de portátil (Windows 8.1). La instalación de la última versión de R me daba problemas al intentar ejecutar códigos que ya había utilizado en mi ordenador anterior (problemas relacionados con librerías). Por tanto, me decidí a desinstalar dicha versión e instalé la 3.0.0 ·Masked Marvel (2013-04-03). Nada más terminar, procedí a la instalación de la librería earth install.packages(earth) library(earth) La instaló sin problemas, pero al intentar ejecutar el código de ejemplo me sale el siguiente error, que era el que me salía con la última instalación de R: earth.mod - earth(Volume ~ ., data = trees) Error en plotmo::check.index(linpreds, linpreds, x, is.col.index = TRUE, : no se pudo encontrar la función anyNA ¿Alguien me podría dar una pista sobre dónde anda el problema? Un saludo y muchas gracias por vuestra ayuda, Fernando ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es -- Saludos, Carlos Ortega www.qualityexcellence.es ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R] Opposite color in R
peter dalgaard pdalgd at gmail.com writes: On 25 Jul 2015, at 21:49 , Atte Tenkanen attenka at utu.fi wrote: Hi, I have tried to find a way to find opposite or complementary colors in R. I would like to form a color circle with R like this one: http://nobetty.net/dandls/ colorwheel/complementary_colors.jpg If you just make a basic color wheel in R, the colors do not form complementary color circle: palette(rainbow(24)) Colors=palette() pie(rep(1, 24), col = Colors) There is a package ”colortools” where you can find function opposite(), but it doesn’t work as is said. I tried library(colortools) opposite(violet) and got green instead of yellow and opposite(blue) and got yellow instead of orange. Do you know any solutions? Not directly, but a few hints: First read up on complementary colors in Wikipedia. In particular, note that the traditional color circle does not satisfy the modern definition of opposite-ness. E.g. red paint mixed with green paint is brown, not black or grey. The construction of the color circle is simple in principle: red, blue, yellow go at 0, 120, 240 degrees, the other colors on the circle are formed by mixing two primaries in varying proportions: green (at 180 deg) is an equal mixture of blue and yellow, violet (at 60 deg) of blue and red, orange (at 300 deg) of red and yellow. Blue-green (at 150 deg) would be half blue, half green, alias three quarter blue, one quarter yellow. Etc. The tricky bit is that the above mixtures are subtractive mixtures (mixing paint rather than light beams) and I don't know how to make a subtractive color mixture in the additive RGB space that we usually work in. Maybe there are tools in the colortools package? -pd Atte Tenkanen To start with, you should be specifying your colors or lights actually in an additive color space like CIE 1931 xy, https://en.wikipedia.org/wiki/CIE_1931_color_space which you can do in the colorspace package. But this is based on an average observer and the results are unlikely to match a given individual's vision. On top of that, decisions made when this norm was specified are such that it deviates from human vision for short wavelengths so that you would be better off using a corrected version like that proposed by Judd in the 1950's or for the most recent suggestion see ww.cvrl.org under New CIE XYZ functions transformed from the CIE (2006) LMS functions best, Ken -- Kenneth Knoblauch Inserm U846 Stem-cell and Brain Research Institute Department of Integrative Neurosciences 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.sbri.fr/members/kenneth-knoblauch.html __ R-help@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.
Re: [R] R GUI plot by color
On 7/24/2015 6:23 AM, Jim Lemon wrote: Hi jpara3, Your example, when I got it to go: one-c(3,2,2) two-c(a,b,b) data-dataframe(one,two) plot(data$one,col=data$two) Wow Jim. Psychic indeed! Not only did you answer with NO reproducible example, but on round 2 you fixed a non-working example and explained why it was an accident that it works. What is the stock market about to do? :) jpara3 - Those of us without Jim's talent can be more helpful if you read and follow the guide at the bottom of each email.: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. does indeed work, and I'll explain how. You are plotting the values of data$one against the _values_ of data$two (see point 3 of my response). In this case, the values of data$two are of class factor, which means that they have numeric values attached to the levels (a, b) of the factor. When you pass these values as the col argument, they are silently converted to their numeric values (1,2,2). In the default palette, these numbers represent the colors - black, red, red. Those are the colors in which the points are plotted. So far, so good. Let's look at the other two points that I guessed. 1) The column names of data2 are not numbers colnames(data) [1] one two As you can see, the column names are character variables, and they don't translate to numbers: as.numeric(colnames(data)) [1] NA NA 2) The number of columns in data2 is not equal to the number of values in data1 that you are plotting It's pretty obvious that there are two values in the column names and three in the vector of values that you are plotting in your example.So, I think I got three out of three without knowing what the data were. Jim On Fri, Jul 24, 2015 at 7:53 PM, jpara3 j.para.fernan...@hotmail.com wrote: I have done a trial with a dataframe like this: one-c(3,2,2) two-c(a,b,b) data-dataframe(uno,dos) plot(data$one,col=data$two) and it plots perfect. If you paste the code above in R, it has errors and does NOT plot perfectly. I still did not understand what you were trying to do. You owe Jim big time. If I try it with the code that i have post in the first message, selecting data1 and data2 as i nthis example, the plot is plotted, but all dots with the same color. Thanks for the answer but noone of the 3 topics is the root problem. -- View this message in context: http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297p4710300.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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. __ R-help@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. __ R-help@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.
[R] Opposite color in R
Thanks, This helps me going on. The description in complementary {colortools} was/is somehow misleading: Complementary or opposite color scheme is formed by colors that are opposite each other on the color wheel (example: red and green). Atte T. / On 25 Jul 2015, at 21:49 , Atte Tenkanen attenka at utu.fi https://stat.ethz.ch/mailman/listinfo/r-help wrote: // // Hi, // // I have tried to find a way to find opposite or complementary colors in R. // // I would like to form a color circle with R like this one:http://nobetty.net/dandls/colorwheel/complementary_colors.jpg // // If you just make a basic color wheel in R, the colors do not form complementary color circle: // // palette(rainbow(24)) // Colors=palette() // pie(rep(1, 24), col = Colors) // // There is a package ”colortools” where you can find function opposite(), but it doesn’t work as is said. I tried // // library(colortools) // opposite(violet) and got green instead of yellow and // // opposite(blue) and got yellow instead of orange. // // Do you know any solutions? / Not directly, but a few hints: First read up on complementary colors in Wikipedia. In particular, note that the traditional color circle does not satisfy the modern definition of opposite-ness. E.g. red paint mixed with green paint is brown, not black or grey. The construction of the color circle is simple in principle: red, blue, yellow go at 0, 120, 240 degrees, the other colors on the circle are formed by mixing two primaries in varying proportions: green (at 180 deg) is an equal mixture of blue and yellow, violet (at 60 deg) of blue and red, orange (at 300 deg) of red and yellow. Blue-green (at 150 deg) would be half blue, half green, alias three quarter blue, one quarter yellow. Etc. The tricky bit is that the above mixtures are subtractive mixtures (mixing paint rather than light beams) and I don't know how to make a subtractive color mixture in the additive RGB space that we usually work in. Maybe there are tools in the colortools package? -pd / // Atte Tenkanen // // __ // R-help at r-project.org https://stat.ethz.ch/mailman/listinfo/r-help mailing list -- To UNSUBSCRIBE and more, see // https://stat.ethz.ch/mailman/listinfo/r-help // PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html // and provide commented, minimal, self-contained, reproducible code. / -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email:pd.mes at cbs.dk https://stat.ethz.ch/mailman/listinfo/r-help Priv:PDalgd at gmail.com https://stat.ethz.ch/mailman/listinfo/r-help [[alternative HTML version deleted]] __ R-help@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.
[R] Compute z
Hi Everyone: How do I correctly compute z? z = 0; for i = 1:7 z = z + v(i) * w(i) end If there are two column vectors v and w, each with 7 elements (i.e., they have dimensions 7x1). Regards, Hal Sent from Surface [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Compute z
Dear Hal Are you looking for %*% by any chance? On 26/07/2015 09:38, admin.dslcompu...@gmail.com wrote: Hi Everyone: How do I correctly compute z? z = 0; for i = 1:7 z = z + v(i) * w(i) end If there are two column vectors v and w, each with 7 elements (i.e., they have dimensions 7x1). Regards, Hal Sent from Surface [[alternative HTML version deleted]] __ R-help@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. -- Michael http://www.dewey.myzen.co.uk/home.html __ R-help@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.
[R] graphviz, Rmarkdown, colorBrewer
Hello. I am drawing a graph using graphviz. It works but now, I am trying to use some palettes from the RColorBrewer pakcage. Any idea why this diagram works when the code (in .Rmd) is ```{r, engine='dot', echo=F} digraph unix{ size=30; ratio=compress; param [label= Contrastes paramétricos , shape=oval, style=filled,rounded,diagonals, fillcolor=dodgerblue3, fontcolor=gray90]; ``` but it doesn't work if I try to use some colors of any palette ```{r, echo=FALSE} library(RColorBrewer) colores - brewer.pal(11,PiYG) ``` ```{r, engine='dot', echo=F} digraph unix{ size=30; ratio=compress; param [label= Contrastes paramétricos , shape=oval, style=filled,rounded,diagonals, fillcolor=colores[1], fontcolor=gray90]; ``` Thank you very much!! -- Aurora González Vidal Sección Apoyo Estadístico. Servicio de Apoyo a la Investigación (SAI). Vicerrectorado de Investigación. Universidad de Murcia Edif. SACE . Campus de Espinardo. 30100 Murcia @. aurora.gonzal...@um.es T. 868 88 7315 F. 868 88 7302 www.um.es/sai www.um.es/ae [[alternative HTML version deleted]] __ R-help@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.
Re: [R-es] error con librería earth
Hola Carlos, Pues opté por instalar una versión que era la que tenía en mi anterior portátil después de que la 3.2.1 me diera problemas. Ahora he vuelto a instalar la 3.2.1 y parece que todo va bien. Un saludo y muchas gracias por tu ayuda, Fernando De: Carlos Ortega [mailto:c...@qualityexcellence.es] Enviado el: domingo, 26 de julio de 2015 21:20 Para: Fernando Sanchez fernandsan...@yahoo.es CC: r-help-es@r-project.org Asunto: Hola, Realmente, lo que correspondería que hicieras es que te actualizaras la versión de R a la 3.2.1 y con ella actualizaras todas las librerías. Se me pasó comentártelo en el correo anterior. El que instalaras la 3.0.3 no sé si es que tenías alguna dependencia de alguna otra librería o un script propio que ya hubieras comprobado que no te funciona con la 3.2.1. Saludos, Carlos Ortega www.qualityexcellence.es El 26 de julio de 2015, 16:26, Fernando Sanchez fernandsan...@yahoo.es escribió: Hola Carlos, Muchas gracias por tu respuesta. Haciendo lo que me decías he logrado solucionar el problema. Sin embargo, me queda una duda: dado que al hacer library(earth), antes de la instalación de las librerías plotmo y plotrix me sale el siguiente mensaje: library(earth) Loading required package: plotmo Loading required package: plotrix Mensajes de aviso perdidos 1: package ‘earth’ was built under R version 3.0.3 2: package ‘plotmo’ was built under R version 3.0.3 3: package ‘plotrix’ was built under R version 3.0.3 ¿no se supone que ya las está instalando? Un saludo, Fernando De: Carlos Ortega [mailto:c...@qualityexcellence.es] Enviado el: domingo, 26 de julio de 2015 14:40 Para: Fernando Sanchez fernandsan...@yahoo.es CC: r-help-es@r-project.org Asunto: Re: [R-es] error con librería earth Hola, ¿ Has comprobado si tienes instaladas igualmente las librerías plotmo y plotrix?. El error que obtienes está asociado a la librería plotmo. Saludos, Carlos Ortega www.qualityexcellence.es El 26 de julio de 2015, 14:24, Fernando Sanchez fernandsan...@yahoo.es escribió: Hola a todos, Recientemente he cambiado de portátil (Windows 8.1). La instalación de la última versión de R me daba problemas al intentar ejecutar códigos que ya había utilizado en mi ordenador anterior (problemas relacionados con librerías). Por tanto, me decidí a desinstalar dicha versión e instalé la 3.0.0 ·Masked Marvel (2013-04-03). Nada más terminar, procedí a la instalación de la librería earth install.packages(earth) library(earth) La instaló sin problemas, pero al intentar ejecutar el código de ejemplo me sale el siguiente error, que era el que me salía con la última instalación de R: earth.mod - earth(Volume ~ ., data = trees) Error en plotmo::check.index(linpreds, linpreds, x, is.col.index = TRUE, : no se pudo encontrar la función anyNA ¿Alguien me podría dar una pista sobre dónde anda el problema? Un saludo y muchas gracias por vuestra ayuda, Fernando ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es -- Saludos, Carlos Ortega www.qualityexcellence.es -- Saludos, Carlos Ortega www.qualityexcellence.es ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R] Opposite color in R
Dear Atte Tenkanen, Re: Hi, I have tried to find a way to find opposite or complementary colors in R. I would like to form a color circle with R like this one: http://nobetty.net/dandls/colorwheel/complementary_colors.jpg If you just make a basic color wheel in R, the colors do not form complementary color circle: palette(rainbow(24)) Colors=palette() pie(rep(1, 24), col = Colors) There is a package ”colortools” where you can find function opposite(), but it doesn’t work as is said. I tried library(colortools) opposite(violet) and got green instead of yellow and opposite(blue) and got yellow instead of orange. Do you know any solutions? Atte Tenkanen Actually, yellow and blue are complementary colours, but red and green aren't. The human visual system has three types of cones: red-sensitive, green-sensitive and blue-sensitive. (the labels are approximate, e.g. red-sensitive cones have their optimum sensitivity at a wavelength we might call orange, but for understanding colours, R-G-B is the useful standard designation). A certain combination of these three together, such as in sunlight, is seen as white. In the digital domain, the three colour channels of an image are usually scaled to 8-bit numbers, i.e. from zero up to and including 255. So, all three channels 255 makes white. Leaving one of the three colors out yields yellow (no blue), magenta (no green) and cyan (no red). The pairs yellow-blue, magenta-green and cyan-red are truly complementary colours. Colours are the result of the wavelength of the light, so one would expect colours to lie on a linear scale, from about 700 nm (red), through 550 (green) to about 440 nm (blue). There is a complication, however: the photosensitive pigment of our red cones has a second action peak past that of the blue cones, so past pure blue we see a sort of reddish blue, in other words violet or purple. Therefore, the colours can be plotted in a circle, where violet and purple fill the gap between blue and red. Using a combination of the three ground colors R, G and B, any desired colour shade can be composed. Orange, for example, consists of (approximately) all red and half green. - - - - - - - - - R has ample possibilities to compose colours or colour palettes, with which one can create (almost continuous) gradients or stepwise colour patches. Examples are col2rgb(): col2rgb(orange) [,1] red255 green 165 blue 0 col2rgb(violet) [,1] red238 green 130 blue 238 Cindy Brewer wrote a fine set of colour functions, adapted to R by Erich Neuwirth. See package RColorBrewer. And much can be done with the standard R distribution: The following code plots a some colours in a circle, with the complementary colours at opposite sides (so crudely what you're after): # define colour triplets reds = c( 255, 255, 255,0,0,0,0, 128) greens = c( 0, 127, 255, 255, 255, 127,0,0) blues= c( 0, 0,0,0, 255, 255, 255, 255) n = length(reds) # compute circle to plot in stp = 2*pi/n th = seq(0,2*pi-stp, length.out=n) x = cos(th); y=sin(th) # plot (on a Mac, for other OSses call the appropriate grahics window quartz(w=5, h=5) par(xpd=NA) plot(x,y,pch=15, cex=8, col=rgb(reds, greens, blues, maxColorValue = 255), asp=1, axes=FALSE, xlab='', ylab='') points(x,y,pch=0, cex=8, col=black) # arrows connect the complementary colours arrows(0,0, 0.7*x, 0.7*y, length = 0.25, col = grey) Hope this helps; Best wishes, Frank -- Franklin Bretschneider Dept of Biology Utrecht University brets...@xs4all.nl __ R-help@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.
[R] Varying name of output tables from looped process of list of spdf objects
Hi, This is a repost from here (http://r.789695.n4.nabble.com/Writing-output-of-a-looped-process-with-pdfs-tt4710348.html), due to the post not being complete originally. I am running R studio on OS X Yosemite 10.10.4 (Mac). I appreciate you help very much! The objective: I have 100 shapefiles that need to undergo the same process. The process: I use gDistance{rgdal} to calculate the distance between all features (polygons) within each layer, and output a txt file. The problem: I need the name of the output txt file to contain the name of the shapefile, but the shapefiles are read into R as SpatialPolygonsDataFrames (spdf) and I cannot find a way to use the name of the spdf objects as character in order to make it vary with each iteration. My questions to you: Do you know a way to solve the problem or an alternative way to fulfil the objective? I have come to determine the problem after searching about the error message, have I interpreted correctly? Here is a minimal dataset for replicability: dput(a_1) new(SpatialPolygonsDataFrame , data = structure(list(ID = 1:3, GRIDCODE = c(1L, 1L, 1L), Shape_Leng = c(3349.48347556, 1618.93904903, 893.268790786), Shape_Area = c(309430.38861, 90015.8325676, 47507.0325775), Count = c(1L, 1L, 1L)), .Names = c(ID, GRIDCODE, Shape_Leng, Shape_Area, Count), row.names = 0:2, class = data.frame) , polygons = list(S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp)) , plotOrder = 1:3 , bbox = structure(c(476685.625393809, 311791.86152084, 508519.585393809, 312935.41622084), .Dim = c(2L, 2L), .Dimnames = list(c(x, y ), c(min, max))) , proj4string = new(CRS , projargs = +proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs ) ) dput(a_10) new(SpatialPolygonsDataFrame , data = structure(list(ID = 1:5, GRIDCODE = c(1L, 1L, 1L, 1L, 1L), Shape_Leng = c(1691.7247095, 2305.45647624, 1022.64650591, 1172.27848042, 94.2722341164), Shape_Area = c(6.47354525991, 92111.8528756, 65.7173995386, 19042.7776647, 415.253663691), Count = c(1L, 1L, 1L, 1L, 1L)), .Names = c(ID, GRIDCODE, Shape_Leng, Shape_Area, Count), row.names = 0:4, class = data.frame) , polygons = list(S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp)) , plotOrder = c(2L, 4L, 5L, 3L, 1L) , bbox = structure(c(825796.904693809, 815666.86152084, 831270.106493809, 816562.46752084), .Dim = c(2L, 2L), .Dimnames = list(c(x, y ), c(min, max))) , proj4string = new(CRS , projargs = +proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs ) ) Here is the code that I have been using: ###Load packages library(rgdal) library(gdistance) ###Read forest shape files setwd(/Users/sisolarrosa/Documents/PhD/R_work/AF/IIC/R_Quest/) shps- dir(getwd(), *.shp) shps - gsub('.{4}$', '', shps) for (shp in shps) assign(shp, readOGR(.,layer=shp)) ###Create list of spdf objects fnps- mget(ls(pattern= a_)) ###For each spatial layer (object in the list), calculate distance between all polygons within layer for (fnp in fnps) { distance.matrix- gDistance(fnp, spgeom2= NULL, byid=T); row.names(distance.matrix) - paste(1:nrow(distance.matrix), sep=”); # did this because gDistance changed the IDs of the features from [1 to ...] to [0 to ...], not sure why colnames(distance.matrix)- paste(1:ncol(distance.matrix), sep=”); # same as above dists.melt - melt(distance.matrix)[melt(upper.tri(distance.matrix))$value,]; #use only lower triangle of the distances matrix outfile - file.path(/Users/sisolarrosa/Documents/PhD/R_work/AF/IIC/conefor_inputs/, paste0(distances_, fnp, .txt)); write.table(dists.melt, outfile,row.names=FALSE, col.names=FALSE) } And this is the error message: Error in as.character.default(S4 object of class SpatialPolygonsDataFrame) : no method for coercing this S4 class to a vector Thank you very much!! Cecilia [[alternative HTML version deleted]] __ R-help@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.
[R] Varying name of output tables from looped process of list of spdf objects
Hi, This is a repost from here (http://r.789695.n4.nabble.com/Writing-output-of-a-looped-process-with-pdfs-tt4710348.html), due to the post not being complete originally. I am running R studio on OS X Yosemite 10.10.4 (Mac). I appreciate you help very much! The objective: I have 100 shapefiles that need to undergo the same process. The process: I use gDistance{rgdal} to calculate the distance between all features (polygons) within each layer, and output a txt file. The problem: I need the name of the output txt file to contain the name of the shapefile, but the shapefiles are read into R as SpatialPolygonsDataFrames (spdf) and I cannot find a way to use the name of the spdf objects as character in order to make it vary with each iteration. My questions to you: Do you know a way to solve the problem or an alternative way to fulfil the objective? I have come to determine the problem after searching about the error message, have I interpreted correctly? Here is a minimal dataset for replicability: dput(a_1) new(SpatialPolygonsDataFrame , data = structure(list(ID = 1:3, GRIDCODE = c(1L, 1L, 1L), Shape_Leng = c(3349.48347556, 1618.93904903, 893.268790786), Shape_Area = c(309430.38861, 90015.8325676, 47507.0325775), Count = c(1L, 1L, 1L)), .Names = c(ID, GRIDCODE, Shape_Leng, Shape_Area, Count), row.names = 0:2, class = data.frame) , polygons = list(S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp)) , plotOrder = 1:3 , bbox = structure(c(476685.625393809, 311791.86152084, 508519.585393809, 312935.41622084), .Dim = c(2L, 2L), .Dimnames = list(c(x, y ), c(min, max))) , proj4string = new(CRS , projargs = +proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs ) ) dput(a_10) new(SpatialPolygonsDataFrame , data = structure(list(ID = 1:5, GRIDCODE = c(1L, 1L, 1L, 1L, 1L), Shape_Leng = c(1691.7247095, 2305.45647624, 1022.64650591, 1172.27848042, 94.2722341164), Shape_Area = c(6.47354525991, 92111.8528756, 65.7173995386, 19042.7776647, 415.253663691), Count = c(1L, 1L, 1L, 1L, 1L)), .Names = c(ID, GRIDCODE, Shape_Leng, Shape_Area, Count), row.names = 0:4, class = data.frame) , polygons = list(S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp), S4 object of class structure(Polygons, package = sp)) , plotOrder = c(2L, 4L, 5L, 3L, 1L) , bbox = structure(c(825796.904693809, 815666.86152084, 831270.106493809, 816562.46752084), .Dim = c(2L, 2L), .Dimnames = list(c(x, y ), c(min, max))) , proj4string = new(CRS , projargs = +proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs ) ) Here is the code that I have been using: ###Load packages library(rgdal) library(gdistance) ###Read forest shape files setwd(/Users/sisolarrosa/Documents/PhD/R_work/AF/IIC/R_Quest/) shps- dir(getwd(), *.shp) shps - gsub('.{4}$', '', shps) for (shp in shps) assign(shp, readOGR(.,layer=shp)) ###Create list of spdf objects fnps- mget(ls(pattern= a_)) ###For each spatial layer (object in the list), calculate distance between all polygons within layer for (fnp in fnps) { distance.matrix- gDistance(fnp, spgeom2= NULL, byid=T); row.names(distance.matrix) - paste(1:nrow(distance.matrix), sep=”); # did this because gDistance changed the IDs of the features from [1 to ...] to [0 to ...], not sure why colnames(distance.matrix)- paste(1:ncol(distance.matrix), sep=”); # same as above dists.melt - melt(distance.matrix)[melt(upper.tri(distance.matrix))$value,]; #use only lower triangle of the distances matrix outfile - file.path(/Users/sisolarrosa/Documents/PhD/R_work/AF/IIC/conefor_inputs/, paste0(distances_, fnp, .txt)); write.table(dists.melt, outfile,row.names=FALSE, col.names=FALSE) } And this is the error message: Error in as.character.default(S4 object of class SpatialPolygonsDataFrame) : no method for coercing this S4 class to a vector Thank you very much!! Cecilia [[alternative HTML version deleted]] __ R-help@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.
[R] VIF threshold implying multicollinearity
Dear All I have a general question about VIF. While there are multiple rules of thumb about the threshold value of VIF, e.g. 4 or 10, implying multicollinearity, I am wondering if anyone can point me to some literature supporting these rules of thumb. Thank you so much! wensui __ R-help@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.
Re: [R] Reading some csv files from different folders and add the name of each files to the first column of files
Hi Lida, You can try this: d- choose.dir() # choose the folder with the subdirectories containing the csv files f - list.files(d, full.names = TRUE, recursive = TRUE) # Here the example for the sing files selsing - grep(sing,f) #Select the files notaining the word sing allsing - data.frame() #Create an empty data frame # Loop among the selected files for (i in 1:length(f[selsing])){ dat - read.csv(file=f[selsing][i]) # suppose that the csv files have a header allsing - rbind(allsing,data.frame(FileID = gsub(EA_sing_|.txt,,basename(f[selsing][i])), dat)) #Combine the file ID with the other columns and add the result to the all sing object } Now, you just have to do it for the other cases and save your final object. Hope this help ! Arnaud ### Date: Sat, 25 Jul 2015 15:03:21 -0500 From: Lida Zeighami lid.z...@gmail.com To: r-help@r-project.org Subject: [R] Reading some csv files from different folders and add the name of each files to the first column of files Message-ID: CAMqbV1CXN0=r+hxmays40smymgdbhdqk1v+n5bhmbpgbr3m...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I have 600 folders in which there are 3 csv files. The name of folders are as follows: EA_aa, EA_bb, EA_cc, EA_dd, In each folder there are 3 csv files: in folder EA_aa there are: EA_sing_aa.csvqwerty EA_ska_aa.csv EA_tat_aa.csv In folder EA_bb: EA_sing_bb.csv EA_ska_bb.csv EA_tat_bb.csv ... I need to read all the same kind of files (for example sing files) in one dataframe but before that I should add a column to each files with the name of file as a row names! So in output I should have just 3 csv files such as EA_sing.csv: (rbind all EA_sing_*.csv file) EA_ska.csv: (rbind all EA_ska_*.csv files) EA_tat.csv: (rbind all EA_tat_*.csv files) And in each file the first column should be added as row names which containing the file name! So the format will be as follow: EA_sing.csv: 1st column 2nd column 3rd column aayhhhghj aa k ki Fyh bb k ki vgd bb k gki Fyh bbk reci Fyh cc k hcd hyd dd lmb Fyh EA_ska.csv: 1st column 2nd column 3rd column aayhhhghj aa k ki Fyh bb k ki Fyh cc k gki Fyh cc k reci oki cc k hcd Fyh dd lmb dsf EA_tat.csv: 1st column 2nd column 3rd column aayhhhghj aa k ki Fyh bb k ki Fyh cc k gki Fyh cc k reci oki dd k hcd Fyh dd lmb dsf Would you please help me how to can I do that? Thanks [[alternative HTML version deleted]] __ R-help@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.
Re: [R] VIF threshold implying multicollinearity
On 27/07/15 13:36, Collin Lynch wrote: The following sources discuss the issues generally and may be a goof pointer to the literature ... SNIP I think that the foregoing merits fortune status! :-) cheers, Rolf -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@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.
[R] Judging if a matrix contains any NA
How do I judge if a matrix contain any NA or otherwise non-missing, non-numerical? In the following, I would like to deliver ONE logical of TRUE or FALSE, rather than a 4 x 4 matrix containing TRUE or FALSE. Thank you. a-matrix(1:16,nrow=4) diag(a)-NA a [,1] [,2] [,3] [,4] [1,] NA59 13 [2,]2 NA 10 14 [3,]37 NA 15 [4,]48 12 NA is.na(a) [,1] [,2] [,3] [,4] [1,] TRUE FALSE FALSE FALSE [2,] FALSE TRUE FALSE FALSE [3,] FALSE FALSE TRUE FALSE [4,] FALSE FALSE FALSE TRUE __ R-help@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.
Re: [R] Judging if a matrix contains any NA
On Jul 26, 2015, at 6:10 PM, Steven Yen wrote: How do I judge if a matrix contain any NA or otherwise non-missing, non-numerical? In the following, I would like to deliver ONE logical of TRUE or FALSE, rather than a 4 x 4 matrix containing TRUE or FALSE. Thank you. a-matrix(1:16,nrow=4) diag(a)-NA a [,1] [,2] [,3] [,4] [1,] NA59 13 [2,]2 NA 10 14 [3,]37 NA 15 [4,]48 12 NA any(is.na( a)) [1] TRUE is.na(a) [,1] [,2] [,3] [,4] [1,] TRUE FALSE FALSE FALSE [2,] FALSE TRUE FALSE FALSE [3,] FALSE FALSE TRUE FALSE [4,] FALSE FALSE FALSE TRUE __ R-help@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. David Winsemius Alameda, CA, USA __ R-help@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.
Re: [R] VIF threshold implying multicollinearity
The following sources discuss the issues generally and may be a goof pointer to the literature on VIF. Particularly the Schroeder paper. @article{Yi:Evaluation, AUTHOR = {Youjae Yi}, TITLE = {On the Evaluation of Main Effects in Multiplicative Regression Models.}, JOURNAL = {Journal of the Market Research Society}, VOLUME = {31}, NUMBER = {1}, MONTH = {January}, YEAR= {1989}, PAGES = {133-138} } @article{Gordon:Issues, AUTHOR = {Robert A. Gordon}, TITLE = {Issues in Multiple Regression}, JOURNAL = {American Journal of Sociology}, VOLUME = {73}, NUMBER = {5}, MONTH = {March}, YEAR= {1968}, PAGES = {592-616} } @misc{Lynch:Multicollinearity, author = {Scott M. Lynch}, title = {Multicollinearity}, year = {2003}, url= {\url{ http://www.princeton.edu/~slynch/soc504/multicollinearity.pdf}}, note = [Online; accessed 11-October-2013] } @article{Schroeder:Multicollinearity, AUTHOR = {Mary Ann Schroeder and Janice Lander and Stacey Levine-Silverman}, TITLE = {Diagnosing and Dealing with Multicollinearity}, JOURNAL = {Western Journal of Nursing Research}, VOLUME = {12}, NUMBER = {2}, YEAR= {1990}, PAGES = {175-187} } @book{Afifi:Computer, AUTHOR= {A. Afifi and V. Clark}, TITLE = {Computer-aided Multivariate Analysis}, PUBLISHER = {Wadsworth, Belmont California}, YEAR = {1984} } On Sun, Jul 26, 2015 at 5:00 PM, Wensui Liu liuwen...@gmail.com wrote: Dear All I have a general question about VIF. While there are multiple rules of thumb about the threshold value of VIF, e.g. 4 or 10, implying multicollinearity, I am wondering if anyone can point me to some literature supporting these rules of thumb. Thank you so much! wensui __ R-help@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. [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Judging if a matrix contains any NA
all(is.na(a)) [1] FALSE -- Original -- From: Steven Yen;sye...@gmail.com; Date: Mon, Jul 27, 2015 09:10 AM To: r-help mailing listr-help@r-project.org; Subject: [R] Judging if a matrix contains any NA How do I judge if a matrix contain any NA or otherwise non-missing, non-numerical? In the following, I would like to deliver ONE logical of TRUE or FALSE, rather than a 4 x 4 matrix containing TRUE or FALSE. Thank you. a-matrix(1:16,nrow=4) diag(a)-NA a [,1] [,2] [,3] [,4] [1,] NA59 13 [2,]2 NA 10 14 [3,]37 NA 15 [4,]48 12 NA is.na(a) [,1] [,2] [,3] [,4] [1,] TRUE FALSE FALSE FALSE [2,] FALSE TRUE FALSE FALSE [3,] FALSE FALSE TRUE FALSE [4,] FALSE FALSE FALSE TRUE __ R-help@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. [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Judging if a matrix contains any NA
On 26/07/2015 9:10 PM, Steven Yen wrote: How do I judge if a matrix contain any NA or otherwise non-missing, non-numerical? David told you about any(). You may also want to use !is.finite() instead of is.na(). Duncan Murdoch In the following, I would like to deliver ONE logical of TRUE or FALSE, rather than a 4 x 4 matrix containing TRUE or FALSE. Thank you. a-matrix(1:16,nrow=4) diag(a)-NA a [,1] [,2] [,3] [,4] [1,] NA59 13 [2,]2 NA 10 14 [3,]37 NA 15 [4,]48 12 NA is.na(a) [,1] [,2] [,3] [,4] [1,] TRUE FALSE FALSE FALSE [2,] FALSE TRUE FALSE FALSE [3,] FALSE FALSE TRUE FALSE [4,] FALSE FALSE FALSE TRUE __ R-help@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. __ R-help@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.