[R] Returning the coefficient parameters from JRI
Hi, I am trying to run R summary command through JRI to get the result for mulitvariate Linear Regression eg. result - lm(Performance Score ~ Department+Grade,data = StudentData) summary(result) on running the above cmd using in R Console will fetch me below result: Call: lm(formula = Performace.Score ~ Department + Grade, data = tree) Residuals: Min 1Q Median 3Q Max -1.0146 -0.8472 0.1206 0.1528 1.3193 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept)1.9085381 0.2063188 9.250 2e-16 *** DepartmentCentral Projects-0.0618622 0.2086085 -0.2970.767 DepartmentConsulting Services -0.0529854 0.2104055 -0.2520.801 DepartmentDistribution-0.2280968 0.2268197 -1.0060.315 DepartmentExecutive0.0896884 0.4008410 0.2240.823 DepartmentFinance -0.1366400 0.2503824 -0.5460.585 DepartmentHR -0.2093362 0.2544092 -0.8230.411 DepartmentIT -0.0301757 0.2236310 -0.1350.893 DepartmentLocal Projects 0.1047488 0.2099865 0.4990.618 DepartmentOperations 0.1009253 0.2078236 0.4860.627 DepartmentRD -0.0436125 0.2115470 -0.2060.837 DepartmentSales -0.1824861 0.2310936 -0.7900.430 Grade 0.0002534 0.0139614 0.0180.986 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.6768 on 1492 degrees of freedom Multiple R-squared: 0.0195,Adjusted R-squared: 0.01161 F-statistic: 2.472 on 12 and 1492 DF, p-value: 0.00335 Now, When i try to run the same command through JRI and trying to get only coefficients for same data ,will fetch below result : [REAL* (1.9085381360123104, -0.061862224682688656, -0.0529853865573166, -0.22809675152091768, 0.0896883836938513, -0.13664002290293625, -0.20933620214453777, -0.03017568582453441, 0.10474877352108226, 0.10092534733241249, -0.04361245714602103, -0.1824861159548225, 2.5335432769115444E-4, 0.20631884004542614, 0.20860854811530719, 0.21040549853856627, 0.2268197334540003, 0.4008409534398062, 0.25038238782600725, 0.2544092401777455, 0.22363101707542418, 0.20998649433526015, 0.20782362789029826, 0.21154702570507078, 0.23109359545008445, 0.013961381053987209, 9.250430719715656, -0.29654693080215805, -0.2518251040269494, -1.0056301012591409, 0.22375054974845454, -0.5457253766502479, -0.8228325433395539, -0.13493515443055484, 0.49883576490325376, 0.48562980233261505, -0.20615963283182023, -0.7896632340650002, 0.018146795557793288, 7.495625279329623E-20, 0.7668537059840453, 0.8012109343341197, 0.31475660028966584, 0.8229820424275262, 0.5853363050818626, 0.4107347156441347, 0.8926813449490922, 0.6179686247435434, 0.6273009677306218, 0.8366943459235678, 0.42984994326833603, 0.9855241729402933)] From the above result what i get from JRI,will fetch me only coefficient values not the parameters like what we get in R Console(Departments list and Grade in this Case). So,my question is how to get coefficient values along with parameters. Thanks, Akash -- View this message in context: http://r.789695.n4.nabble.com/Returning-the-coefficient-parameters-from-JRI-tp4708987.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] Call to a function
On Jun 23, 2015, at 3:20 PM, boB Rudis wrote: You can do something like: aaa - function(data, w=w) { if (class(w) %in% c(integer, numeric, double)) { I think you will find that inherits(w, numeric) is more compact and safer. Both integer and double do inherit from numeric (and double is equivalent to numeric) The test for 'is.vector' is also going to produce some surprises. List-objects may pass that test: sum( list(1,2,3)) Error in sum(list(1, 2, 3)) : invalid 'type' (list) of argument is.vector( list(1,2,3)) [1] TRUE x=1:4 attr(x, some_attr) - something is.vector(x) [1] FALSE -- David. out - mean(w) } else { out - mean(data[, w]) } return(out) } (there are some typos in your function you may want to double check, too) On Tue, Jun 23, 2015 at 5:39 PM, Steven Yen sye...@gmail.com wrote: mydata-data.frame(matrix(1:20,ncol=2)) colnames(mydata) -c(v1,v2) summary(mydata) aaa-function(data,w=w){ if(is.vector(w)){ out-mean(w) } else { out-mean(data[wt]) } return(out) } aaa(mydata,mydata$v1) aaa(mydata,v1) # want this call to work __ 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] 'class(.) == **' [was 'Call to a function']
Steve Taylor steve.tay...@aut.ac.nz on Wed, 24 Jun 2015 00:56:26 + writes: Note that objects can have more than one class, in which case your == and %in% might not work as expected. Better to use inherits(). cheers, Steve Yes indeed, as Steve said, really do! The use of (class(.) == ) it is error prone and against the philosophy of classes (S3 or S4 or ..) in R : Classes can extend other classes or inherit from them; S3 examples in base R are - glm() objects which are glm but also inherit from lm - multivariate time-series are mts and ts - The time-date objects POSIXt , POSIXct, POSIXlt == do work with inherits(obj, class)) or possibly is( obj, class) We've seen this use of class(.) == ..(or '!= or %in% ...) in too many places; though it may work fine in your test cases, it is wrong to be used in generality e.g. inside a function you provide for more general use, and is best replaced with the use of inherits() / is() everywhere out of principle. Martin Maechler ETH Zurich __ 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] Returning the coefficient parameters from JRI
I don't use JRI, but the data seem to be there. If you are looking for the row names, try ?rownames. --- 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 June 23, 2015 10:15:54 PM PDT, akashdeep akashdeep...@iqss.co.in wrote: Hi, I am trying to run R summary command through JRI to get the result for mulitvariate Linear Regression eg. result - lm(Performance Score ~ Department+Grade,data = StudentData) summary(result) on running the above cmd using in R Console will fetch me below result: Call: lm(formula = Performace.Score ~ Department + Grade, data = tree) Residuals: Min 1Q Median 3Q Max -1.0146 -0.8472 0.1206 0.1528 1.3193 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept)1.9085381 0.2063188 9.250 2e-16 *** DepartmentCentral Projects-0.0618622 0.2086085 -0.2970.767 DepartmentConsulting Services -0.0529854 0.2104055 -0.2520.801 DepartmentDistribution-0.2280968 0.2268197 -1.0060.315 DepartmentExecutive0.0896884 0.4008410 0.2240.823 DepartmentFinance -0.1366400 0.2503824 -0.5460.585 DepartmentHR -0.2093362 0.2544092 -0.8230.411 DepartmentIT -0.0301757 0.2236310 -0.1350.893 DepartmentLocal Projects 0.1047488 0.2099865 0.4990.618 DepartmentOperations 0.1009253 0.2078236 0.4860.627 DepartmentRD -0.0436125 0.2115470 -0.2060.837 DepartmentSales -0.1824861 0.2310936 -0.7900.430 Grade 0.0002534 0.0139614 0.0180.986 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.6768 on 1492 degrees of freedom Multiple R-squared: 0.0195,Adjusted R-squared: 0.01161 F-statistic: 2.472 on 12 and 1492 DF, p-value: 0.00335 Now, When i try to run the same command through JRI and trying to get only coefficients for same data ,will fetch below result : [REAL* (1.9085381360123104, -0.061862224682688656, -0.0529853865573166, -0.22809675152091768, 0.0896883836938513, -0.13664002290293625, -0.20933620214453777, -0.03017568582453441, 0.10474877352108226, 0.10092534733241249, -0.04361245714602103, -0.1824861159548225, 2.5335432769115444E-4, 0.20631884004542614, 0.20860854811530719, 0.21040549853856627, 0.2268197334540003, 0.4008409534398062, 0.25038238782600725, 0.2544092401777455, 0.22363101707542418, 0.20998649433526015, 0.20782362789029826, 0.21154702570507078, 0.23109359545008445, 0.013961381053987209, 9.250430719715656, -0.29654693080215805, -0.2518251040269494, -1.0056301012591409, 0.22375054974845454, -0.5457253766502479, -0.8228325433395539, -0.13493515443055484, 0.49883576490325376, 0.48562980233261505, -0.20615963283182023, -0.7896632340650002, 0.018146795557793288, 7.495625279329623E-20, 0.7668537059840453, 0.8012109343341197, 0.31475660028966584, 0.8229820424275262, 0.5853363050818626, 0.4107347156441347, 0.8926813449490922, 0.6179686247435434, 0.6273009677306218, 0.8366943459235678, 0.42984994326833603, 0.9855241729402933)] From the above result what i get from JRI,will fetch me only coefficient values not the parameters like what we get in R Console(Departments list and Grade in this Case). So,my question is how to get coefficient values along with parameters. Thanks, Akash -- View this message in context: http://r.789695.n4.nabble.com/Returning-the-coefficient-parameters-from-JRI-tp4708987.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] Error in lsmeans function
Dear members, I would like to conduct nonparametric two way ANOVA (repeated measures) and post hoc test by using ARTool and lsmeans package. I have the following data, x-runif(120) A-gl(3,40,labels=c(a1,a2,a3)) B-gl(2,20,120,labels=c(b1,b2)) ID-gl(20,1,120) data-data.frame(ID,x,A,B) Then, I use art function in the ARTool package, dataART-art(x~A*B+(1|ID),data=data) But when I use lsmeans function in lsmeans package for post hoc test, the next error is shown. lsmeans(artlm(dataART, A), pairwise ~ A) NOTE: Results may be misleading due to involvement in interactions $lsmeans Error in format.default(nm[j], width = nchar(m[1, j]), just = left) : 4 arguments passed to .Internal(nchar) which requires 3 Would you mind telling me what is wrong? Best Regards, __ 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] Repeated Measures ANOVA and the Bonferroni post hoc test different results of significantly
On 24 Jun 2015, at 03:28 , gianni lavaredo gianni.lavar...@gmail.com wrote: I am doing an Repeated Measures ANOVA and the Bonferroni post hoc test for my data using R project. The ANOVA gives a significantly difference between the data but not the Bonferroni post hoc test. anova(aov2) numDF denDF F-value p-value (Intercept) 1 1366 110.51125 .0001 time5 1366 9.84684 .0001 while pairwise.t.test(x=table.metric2$value, g=table.metric2$time, p.adj=bonf) And? Notice that pairwise.t.test does not take the plot variable into account. It might if you use paired=TRUE, *IF* your data layout allows it (so that when you split the data by times, observations in each subvector are from the same plots in the same order). -pd -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.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] Lavaan
Does the package semPlot not do what you want? I notice that you got an error when you used library(semPlot) because you don't have all the dependencies installed. When you have semPlot working, it should be able to produce a graphical output of the results, including 'covariance arrows'. David On 23 June 2015 at 17:47, deva d devazresea...@gmail.com wrote: i am attaching a .csv file, and the associated code worked out in R Studio. i used the lavaan and sem packages, and conducted it. now, i wish to draw the SEM model, as is available in AMOS other packages and how does one draw the covariance arrows in R. ONE STATISTICS oriented question - how can one provide interpretation for negative coefficients. kindly guide. thanks and regds, taxliability - read.csv(~/R WORK SPACE/taxliability.csv) View(taxliability) model -'tax~ inc + exp + svg + inv' fit - sem(model, data = taxliability) Error: could not find function sem library(lavaan, lib.loc=~/R/win-library/3.2) This is lavaan 0.5-18 lavaan is BETA software! Please report any bugs. fit - sem(model, data = taxliability) Warning message: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING: could not compute standard errors! lavaan NOTE: this may be a symptom that the model is not identified. library(sem, lib.loc=~/R/win-library/3.2) Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘htmlwidgets’ Error: package or namespace load failed for ‘sem’ fit - sem(model, data = taxliability) Warning message: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING: could not compute standard errors! lavaan NOTE: this may be a symptom that the model is not identified. summary(fit,rsq=T, fit.measures=TRUE) lavaan (0.5-18) converged normally after 1 iterations Number of observations66 Estimator ML Minimum Function Test Statistic0.000 Degrees of freedom 0 Model test baseline model: Minimum Function Test Statistic 160.444 Degrees of freedom 4 P-value0.000 User model versus baseline model: Comparative Fit Index (CFI)1.000 Tucker-Lewis Index (TLI) 1.000 Loglikelihood and Information Criteria: Loglikelihood user model (H0) -3441.453 Loglikelihood unrestricted model (H1) -3441.453 Number of free parameters 5 Akaike (AIC)6892.905 Bayesian (BIC) 6903.854 Sample-size adjusted Bayesian (BIC) 6888.113 Root Mean Square Error of Approximation: RMSEA 0.000 90 Percent Confidence Interval 0.000 0.000 P-value RMSEA = 0.05 1.000 Standardized Root Mean Square Residual: SRMR 0.000 Parameter estimates: Information Expected Standard Errors Standard Estimate Std.err Z-value P(|z|) Regressions: tax ~ inc 0.103 exp -0.023 svg -0.073 inv 0.222 Variances: tax 4662558.169 R-Square: tax 0.912 semPlot Error: object 'semPlot' not found library(semPlot, lib.loc=~/R/win-library/3.2) Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘htmlwidgets’ Error: package or namespace load failed for ‘semPlot’ semPlot:: Error: unexpected end of line in semPlot:: ** *Deva* ... *in search of knowledge, everyday something is added * *in search of wisdom, everyday something is dropped ... an old Chinese Proverb* : On Tue, Jun 23, 2015 at 9:03 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Hi, There are various tutorials for lavaan online, and even an entire book on the R package. Have you worked through those examples and tutorials successfully? If so, a clearer description of what you've tried and what failed is required to be able to help you. Without a reproducible example that includes some sample data (fake is fine), the code you used, and some clear idea of what output you expect, it's impossible to figure out how to help you. Here are some suggestions for creating a good reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah On Tue, Jun 23, 2015 at 10:48 AM, DzR devazresea...@gmail.com wrote: Dear Senior users of R/R Studio, I am very new to this environment hence am unable
Re: [R] define absolute size in plots ... possible?
On 24/06/2015 7:08 AM, Martin Batholdy via R-help wrote: Hi, I would like to define the size for tick-marks, axis-titles, legends, drawing symbols etc. absolute, meaning that regardless of the size of the plot device, the font-size / character size is the same. Thus if I output my plot with pdf(width=5, height=5) or pdf(width=15, height=15), the font-size / symbol-size remains the same. Is that possible in R? That's the default, isn't it? You need to give some reproducible code and explain what you don't like about the results. Duncan Murdoch __ 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] spacetime stConstruct gives wrong dimensions for long table
I have a large spatiotemporal database (131 spatial locations, 9 years of daily weather data) in long table format which I would like to convert to an ST object. head(tempmean) site latlon alt var year mth day value date doy numdate 518941 27015260 6.02 -75.37 1680 AVERAGE DAILY TEMPERATURE VALUES 2006 1 1 16.9 2006-01-01 001 13149 518942 27015260 6.02 -75.37 1680 AVERAGE DAILY TEMPERATURE VALUES 2006 1 2 16.4 2006-01-02 002 13150 518943 27015260 6.02 -75.37 1680 AVERAGE DAILY TEMPERATURE VALUES 2006 1 3 16.9 2006-01-03 003 13151 518944 27015260 6.02 -75.37 1680 AVERAGE DAILY TEMPERATURE VALUES 2006 1 4 16.1 2006-01-04 004 13152 518945 27015260 6.02 -75.37 1680 AVERAGE DAILY TEMPERATURE VALUES 2006 1 5 16.6 2006-01-05 005 13153 518946 27015260 6.02 -75.37 1680 AVERAGE DAILY TEMPERATURE VALUES 2006 1 6 16.7 2006-01-06 006 13154 The data.frame is ‘ragged’, i.e. not all sites are represented by all dates, and there are some NA values in the data. I took a subset of the data (4 sites, 31 days in January 2006, for which all site/date combinations are present) and tried st - stConstruct(tempmean, 3:2, 10) summary(st) Object of class STIDF with Dimensions (s, t, attr): (124, 124, 9) [[Spatial:]] Object of class SpatialPoints Coordinates: minmax lon -76.45 -73.11 lat 2.11 7.07 Is projected: NA proj4string : [NA] Number of points: 124 [[Temporal:]] Index timeIndex Min. :2006-01-01 Min. : 1.00 1st Qu.:2006-01-08 1st Qu.: 31.75 Median :2006-01-16 Median : 62.50 Mean :2006-01-16 Mean : 62.50 3rd Qu.:2006-01-24 3rd Qu.: 93.25 Max. :2006-01-31 Max. :124.00 This is incorrect: There should be 4 spatial dimensions and 31 timepoints. What am I doing wrong? Thanks, Dan Dr Dan Bebber Senior Research Fellow Biosciences University of Exeter __ 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] Combining estimates from multiple regressions
I am interested in using quantile regression to fit the following model at different quantiles of a response variable: (1) y = b0 + b1*g1 + b2*g2 + B*Z where b0 is an intercept, g1 and g2 are dummy variables for 2 of 3 independent groups, and Z is a matrix of covariates to be adjusted for in the estimation (e.g., age, gender). The problem is that estimates for g2 and g1 are not estimable at all quantiles. To overcome this, one option is to fit a separate model for each group (i.e., group 0, which is reflected by intercept above, group 1, and group 2): (2) y = b11 + B1*Z (model for group 0) (3) y = b12 + B2*Z (model for group 1) (4) y = b13 + B3*Z (model for group 2) This would correspond to fitting a single model in which group membership was interacted with all covariates, albeit some of the interaction terms would not be estimable for the reason noted above. However, I ultimately would like to base inferences on a single set of estimates. Can anyone suggest an approach to combine estimates from models (2)-(4), perhaps through weighted averaging, to generate estimates for the model presented in (1) above? An approach is not immediately clear to me since the group effects are subsumed in the intercepts in (2)-(4), whereas (1) includes separate estimates of group effects instead of a single weighted average. Regards, Jim [[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] define absolute size in plots ... possible?
Hi, That's the default, isn't it? I am sorry – one of my plots was actually set up with mfrow. But the documentation actually explains the change in cex when using mfrow; In a layout with exactly two rows and columns the base value of cex is reduced by a factor of 0.83: if there are three or more of either rows or columns, the reduction factor is 0.66.” On 24 Jun 2015, at 13:17 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 24/06/2015 7:08 AM, Martin Batholdy via R-help wrote: Hi, I would like to define the size for tick-marks, axis-titles, legends, drawing symbols etc. absolute, meaning that regardless of the size of the plot device, the font-size / character size is the same. Thus if I output my plot with pdf(width=5, height=5) or pdf(width=15, height=15), the font-size / symbol-size remains the same. Is that possible in R? That's the default, isn't it? You need to give some reproducible code and explain what you don't like about the results. Duncan Murdoch __ 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] Lavaan
Have you considered using the semPlot package? It works nicely with lavaan models (among other sem packages). There is also the DiagrammeR package. Rick On 06/23/2015 10:48 AM, DzR wrote: Dear Senior users of R/R Studio, I am very new to this environment hence am unable to plot the SEM models including use of graphic package ggplot. Request for some help in getting the plots please. Thanks, - Deva __ 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. -- Richard A. Bilonick, PhD Assistant Professor Dept. of Ophthalmology, School of Medicine Dept. of Biostatistics, Graduate School of Public Health Dept. of Orthodontics, School of Dental Medicine University of Pittsburgh Principal Investigator for the Pittsburgh Aerosol Research and Inhalation Epidemiology Study (PARIES) 412 647 5756 __ 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] time management graph
Another option would be to use segments instead of lines. library(lubridate) temp$end - temp$time + minutes(temp$duration) library(ggplot2) ggplot(temp, aes(x=time, xend = end, y=Typ, yend = Typ, colour=person)) + geom_segment() ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-24 12:50 GMT+02:00 Jim Lemon drjimle...@gmail.com: Hi Petr, I'm not exactly sure this is what you are looking for, but try: start_indices-which(!is.na(temp$duration)) pp_gantt_info-list( labels=paste(as.character(temp$person[start_indices]), temp$Akce,temp$Typ,sep=-), starts=temp$time[start_indices], ends=temp$time[start_indices+1], require(plotrix) vgridpos-as.POSIXct(strptime( paste(2015-06-23 ,c(16,17,18,19,20,21,22,23),:00:00,sep=), format=%Y-%m-%d %H:%M:%S)) vgridlab-paste(c(16,17,18,19,20,21,22,23),:00,sep=) gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) Jim On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Dear all Did anybody tried to do time management graphs in R? I could do some aggregation xtabs(duration~person+Typ, data=temp) but I would like to make also a graph to show which task (Typ) and when was done by which person. The closest I came till this evening is following graph, but it is not exactly what I want. library(ggplot2) p-ggplot(temp, aes(x=time, y=Typ, colour=person)) p+geom_line() If anybody can focus me to proper functions or packages I would be greatful. Here are the data. temp - structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x), class = factor), Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, 6L, 7L, 4L, 4L), .Label = c(A, B, C, D, E, F, G, H), class = factor), person = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(One, Two), class = factor), time = structure(c(1435038600, 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435065600, 1435068000), class = c(POSIXct, POSIXt), tzone = ), duration = c(10, 10, 5, 5, 6, 24, 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 60, 40, NA)), .Names = c(Akce, Typ, person, time, duration), class = data.frame, row.names = c(NA, -59L)) Best regards Petr Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je
Re: [R] time management graph
Hi Petr, I'm not exactly sure this is what you are looking for, but try: start_indices-which(!is.na(temp$duration)) pp_gantt_info-list( labels=paste(as.character(temp$person[start_indices]), temp$Akce,temp$Typ,sep=-), starts=temp$time[start_indices], ends=temp$time[start_indices+1], require(plotrix) vgridpos-as.POSIXct(strptime( paste(2015-06-23 ,c(16,17,18,19,20,21,22,23),:00:00,sep=), format=%Y-%m-%d %H:%M:%S)) vgridlab-paste(c(16,17,18,19,20,21,22,23),:00,sep=) gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) Jim On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Dear all Did anybody tried to do time management graphs in R? I could do some aggregation xtabs(duration~person+Typ, data=temp) but I would like to make also a graph to show which task (Typ) and when was done by which person. The closest I came till this evening is following graph, but it is not exactly what I want. library(ggplot2) p-ggplot(temp, aes(x=time, y=Typ, colour=person)) p+geom_line() If anybody can focus me to proper functions or packages I would be greatful. Here are the data. temp - structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x), class = factor), Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, 6L, 7L, 4L, 4L), .Label = c(A, B, C, D, E, F, G, H), class = factor), person = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(One, Two), class = factor), time = structure(c(1435038600, 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435065600, 1435068000), class = c(POSIXct, POSIXt), tzone = ), duration = c(10, 10, 5, 5, 6, 24, 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 60, 40, NA)), .Names = c(Akce, Typ, person, time, duration), class = data.frame, row.names = c(NA, -59L)) Best regards Petr Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please
[R] define absolute size in plots ... possible?
Hi, I would like to define the size for tick-marks, axis-titles, legends, drawing symbols etc. absolute, meaning that regardless of the size of the plot device, the font-size / character size is the same. Thus if I output my plot with pdf(width=5, height=5) or pdf(width=15, height=15), the font-size / symbol-size remains the same. Is that possible in R? Thank you! __ 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] repeated measures: multiple comparisons with pairwise.t.test and multcomp disagree
Bert, can you be more specific about which article for those of us who don't subscribe? --- 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 June 24, 2015 12:13:05 PM PDT, Bert Gunter bgunter.4...@gmail.com wrote: I would **strongly** recommend that you speak with a local statistical expert before proceeding further. Your obsession with statistical significance is very dangerous. (see the current issue of SIGNIFICANCE for some explanation). Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Wed, Jun 24, 2015 at 10:30 AM, Denis Chabot denis.cha...@me.com wrote: Thank you, Thierry. And yes, Bert, it turns out that it is more of a statistical question after all, but again, since my question used specific R functions, R experts are well placed to help me. As pairewise.t.test was recommended in a few tutorials about repeated-measure Anovas, I assumed it took into account the fact that the measures were indeed repeated, so thank you for pointing out that it does not. But my reason for not accepting the result of multcomp went further than this. Before deciding to test 4 different durations, I had tested only two of them, corresponding to sets 1 and 2 of my example. I used a paired t test (as in t test for paired samples). I had a very significant effect, i.e. the mean of the differences calculated for each subject was significantly different from zero. After adding two other durations and switching from my paired t test to a repeated measures design, these same 2 sets are no longer different. I think the explanation is lack of homogeneity of variances. I thought a log transformation of the raw data had been sufficient to fix this, and a Levene test on the variances of the 4 sets found no problem in this regard. But maybe it is the variance of all the possible differences (set 1 vs 2, etc, for a total of 6 differences calculated for each subject) that matters. I just calculated these and they range from 1.788502e-05 to 1.462171e-03. A Levene test on these 6 groups showed that their variances were heterogeneous. I think I'll stay away from the repeated measures followed by multiple comparisons and just report my 6 t tests for paired samples, correcting the p-level for the number of comparisons with, say, the Sidak method (p for significance is then 0.0085). Thanks for your help. Denis Le 2015-06-23 à 08:15, Thierry Onkelinx thierry.onkel...@inbo.be a écrit : Dear Denis, It's not multcomp which is too conservative, it is the pairwise t-test which is too liberal. The pairwise t-test doesn't take the random effect of Case into account. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-23 5:17 GMT+02:00 Denis Chabot denis.cha...@me.com: Hi, I am working on a problem which I think can be handled as a repeated measures analysis, and I have read many tutorials about how to do this with R. This part goes well, but I get stuck with the multiple comparisons I'd like to run afterward. I tried two methods that I have seen in my readings, but their results are quite different and I don't know which one to trust. The two approaches are pairwise.t.test() and multcomp, although the latter is not available after a repeated-measures aov model, but it is after a lme. I have a physiological variable measured frequently on each of 67 animals. These are then summarized with a quantile for each animal. To check the effect of experiment duration, I recalculated the quantile for each animal 4 times, using different subset of the data (so the shortest subset is part of all other subsets, the second subset is included in the 2 others, etc.). I handle this as 4 repeated (non-independent) measurements for each animal, and want to see if the average value (for 67 animals) differs for the 4
Re: [R] repeated measures: multiple comparisons with pairwise.t.test and multcomp disagree
Andrew Gelman's Working Through Some Issues and the two Letters to the Editor that follow responding to the editorial decision to ban P values from The Journal of Basic and Applied Social Psychology (BASP). You may wish also to read ASA President's David Morgenstern's reflexive and entirely predictable reaction (P-values are OK; it's their abuse/misuse that is the problem) in the June 2015 Amstat News. While I have lots of personal opinions on this, this is not the venue to (further?) air them. If you wish to engage me -- pro or con; I welcome both -- please respond privately. I will not comment further on list. Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Wed, Jun 24, 2015 at 2:37 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: Bert, can you be more specific about which article for those of us who don't subscribe? --- 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 June 24, 2015 12:13:05 PM PDT, Bert Gunter bgunter.4...@gmail.com wrote: I would **strongly** recommend that you speak with a local statistical expert before proceeding further. Your obsession with statistical significance is very dangerous. (see the current issue of SIGNIFICANCE for some explanation). Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Wed, Jun 24, 2015 at 10:30 AM, Denis Chabot denis.cha...@me.com wrote: Thank you, Thierry. And yes, Bert, it turns out that it is more of a statistical question after all, but again, since my question used specific R functions, R experts are well placed to help me. As pairewise.t.test was recommended in a few tutorials about repeated-measure Anovas, I assumed it took into account the fact that the measures were indeed repeated, so thank you for pointing out that it does not. But my reason for not accepting the result of multcomp went further than this. Before deciding to test 4 different durations, I had tested only two of them, corresponding to sets 1 and 2 of my example. I used a paired t test (as in t test for paired samples). I had a very significant effect, i.e. the mean of the differences calculated for each subject was significantly different from zero. After adding two other durations and switching from my paired t test to a repeated measures design, these same 2 sets are no longer different. I think the explanation is lack of homogeneity of variances. I thought a log transformation of the raw data had been sufficient to fix this, and a Levene test on the variances of the 4 sets found no problem in this regard. But maybe it is the variance of all the possible differences (set 1 vs 2, etc, for a total of 6 differences calculated for each subject) that matters. I just calculated these and they range from 1.788502e-05 to 1.462171e-03. A Levene test on these 6 groups showed that their variances were heterogeneous. I think I'll stay away from the repeated measures followed by multiple comparisons and just report my 6 t tests for paired samples, correcting the p-level for the number of comparisons with, say, the Sidak method (p for significance is then 0.0085). Thanks for your help. Denis Le 2015-06-23 à 08:15, Thierry Onkelinx thierry.onkel...@inbo.be a écrit : Dear Denis, It's not multcomp which is too conservative, it is the pairwise t-test which is too liberal. The pairwise t-test doesn't take the random effect of Case into account. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-23 5:17 GMT+02:00 Denis Chabot denis.cha...@me.com: Hi, I am working on a problem which I think can be handled as a repeated measures analysis, and I have read many tutorials about how to do this with R. This part goes well, but I get stuck with the
Re: [R] Usage of vcd packages.
On 6/23/15 4:07 PM, My List wrote: All, I am new to the vcd package and new to R too. Welcome to R and glad you found the vcd package. 1) I have a lickert analysis based data set. 2) I am doing a hypothesis tests on the variables ( like, is there a relationship between the choice of a Doctor based on the Patients Income , that's just one example) 3) I am building contingency tables ( R x C) and running chiqsqr.test on these tables. These are mostly 2 x 2 tables. In some cases I am getting very low counts of the variables in these ( R x C ) tables. I wanted to know at what point do I need to use Your questions are reasonable concerns for someone doing this sort of analysis with possibly small cell counts, but without any details, you are really asking for statistical consulting help, rather than R-help, and you would be better off posting your questions to http://stats.stackexchange.com/ How do I show if there is any association between the variables in the R x C setup?Should be I using oddratio() or or assocstats() or should I use Cramers V test for 2 x 2 tables. odds ratios, Cramer`s V etc. are different ways of quantifying the degree of association, with different metrics and different interpretations of the numbers. Please, advice or lead me to a source. Perhaps the notes from my old short course on categorical data might be useful, particularly lecture 2 http://www.datavis.ca/courses/VCD/ More generally, since you`re using vcd, you may find more comfort with the visual methods fourfold(), mosaic() and friends than with the numerical summaries. *Example of Case - Age of patients and If the Dr Justified a Diagnostic Test on them.* DrJustifyDgntTstNo DrJustifyDgntTstYes Age21-40 1 91 Age41-50 4 30 GtrThan51 3 50 Thanks in advance, Harmeet [[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] Broken links (???) in rw-FAQ
On Jun 24, 2015, at 10:52 AM, Chel Hee Lee wrote: Could you also kindly check the following links in the rw-FAQ manual at http://cran.r-project.org/bin/windows/base/rw-FAQ.html?? The links list in the below seem to be broken. I hope these links are fixed in the very near future. Under the section 2.4 Can I customize the installation? * Setup (http://jrsoftware.org/ishelp.php) for details. Under the section 3.3 I want to run R in Chinese/Japanese/Korean * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_language_and_country_strings.asp Under the section 2.26 There is no tilde on my keyboard! * http://office.microsoft.com/en-us/word/HP052590631033.aspx With regard to this one, there was a discussion of this just yesterday in StackOverflow (relative to Italian keyboards which don't seem to be mentioned in the current version of the rw-FAQ). Admittedly this material is not immediately relevant to a windows setup since the question was coming from a Linux user. http://stackoverflow.com/questions/31015152/how-to-type-tilde-in-r http://superuser.com/questions/667622/italian-keyboard-entering-the-tilde-and-backtick-characters-without-cha Looking at some of the linked material, it appears that Windows and Linux have distinctly different answers to tilde-deficient keyboard concerns, so there might be a reason to move a more general answer to R-FAQ and perhaps include material in the section on Internationalization? I could find no mention of tilde-problems in the R-FAQ or the Admin/Setup document. This link is in fact moved to https://support.office.com/en-us/article/HP052590631?CorrelationId=98eaa529-e95a-4628-90ac-1a1da4526b17 That link was 404-ed when I tried it. Under the section 2.24 Does R run under Windows Vista/7/8/Server 2008? * http://windowsvistablog.com/blogs/windowsvista/archive/2007/01/23/security-features-vs-convenience.aspx I appreciate your help! Chel Hee Lee -- 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] create a dummy variables for companies with complete history.
You may want to consider another way of getting your answer that takes advantage of some of R's features: # Make some example data cods - LETTERS[1:10] # Ten companies yrs - 2010:2014 # 5 years set.seed(42) # Set random seed so we all get the same values # Chances of revenue for a given year are 95% rev - round(rbinom(50, 1, .95)*runif(50, 25, 50), 2) z - data.frame(expand.grid(year=yrs, cod=cods)[, 2:1], rev) # Remove years with missing (0) revenue z - z[z$rev 1, ] str(z) 'data.frame': 45 obs. of 3 variables: $ cod : Factor w/ 10 levels A,B,C,D,..: 1 1 1 1 1 2 2 2 2 2 ... $ year: int 2010 2011 2012 2013 2014 2010 2011 2012 2013 2014 ... $ rev : num 33.3 33.7 35 44.6 26 ... # Construct the dummy variable tbl - xtabs(~cod+year, z) tbl year cod 2010 2011 2012 2013 2014 A11111 B11111 C11111 D10111 E11011 F11111 G11111 H11111 I11101 J01101 dummy - as.integer(apply(tbl, 1, all)) dummy [1] 1 1 1 0 0 1 1 1 0 0 - David L Carlson Department of Anthropology Texas AM University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Dewey Sent: Wednesday, June 24, 2015 2:12 PM To: giacomo begnis; r-help@r-project.org Subject: Re: [R] create a dummy variables for companies with complete history. Comments below On 24/06/2015 19:26, giacomo begnis wrote: Hi, I have a dataset (728 obs) containing three variables code of a company, year and revenue. Some companies have a complete history of 5 years, others have not a complete history (for instance observations for three or four years).I would like to determine the companies with a complete history using a dummy variables.I have written the following program but there is somehting wrong because the dummy variable that I have create is always equal to zero.Can somebody help me?Thanks, gm z-read.table(file=c:/Rp/cddat.txt, sep=, header=T) attach(z) n-length(z$cod) // number of obs dataset Could also use nrow(z) d1-numeric(n) // dummy variable for (i in 5:n) { if (z$cod[i]==z$cod[i-4]) // cod is the code of a company { d1[i]=1} else { d1[i]=0} // d1=1 for a company with complete history, d1=0 if the history is not complete }d1 Did you really type = which means less than or equals to? If so, try replacing it with - and see what happens. When I run the program d1 is always equal to zero. Why? Once I have create the dummy variable with subset I obtains the code of the companies with a complete history and finally with a merge I determine a panel of companies with a complete history.But how to determine correctly d1?My best regards, gm [[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-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] create a dummy variables for companies with complete history.
Giacomo, Please include some representative data. It is not clear why your offset of 4 (z$cod[i - 4]) is going to be an accurate surrogate for complete data. Since I do not have your data set or its true structure I am having to guess. # make 5 copies of 200 companies companies - paste0(rep(LETTERS[1:4], 5, each = 50), rep(1:50, 5)) companies - companies[order(companies)] years - rep(1:5, 200) z - data.frame(cod = companies, year = years, revenue = round(rnorm(1000, mean = 10, sd = 1))) # trim this down to the 728 rows you have by pulling out records at random set.seed(1) # so that you can repeat these results z - z[sample.int(1000, 728), ] z - z[order(z$cod, z$year), ] #No matter how you order these data, your offset approach will not tell you which companies have full records. head(z, 10) cod year revenue 1 A11 112192 2 A12 105840 4 A14 112357 5 A15 91772 7 A102 102601 8 A103 105183 11 A111 101269 12 A112 100719 14 A114 86138 15 A115 105044 #You can do something like the following. counts - table(z$cod) complete - names(counts[as.integer(counts) == 5]) # It is probably better to keep the dummy variable inside the dataframe. z$complete - ifelse(z$cod %in% complete, TRUE, FALSE) head(z, 20) cod year revenue complete 1 A11 112192FALSE 2 A12 105840FALSE 4 A14 112357FALSE 5 A15 91772FALSE 7 A102 102601FALSE 8 A103 105183FALSE 11 A111 101269FALSE 12 A112 100719FALSE 14 A114 86138FALSE 15 A115 105044FALSE 20 A125 95872FALSE 21 A131 78513 TRUE 22 A132 90502 TRUE 23 A133 108683 TRUE 24 A134 110711 TRUE 25 A135 87842 TRUE 28 A143 99939FALSE 30 A145 111289FALSE 31 A151 100930FALSE 32 A152 93765FALSE Do not use HTML. Use plain text. The character string // is not a comment indicator in R. Do not use attach(). It does not do anything in your example, but it is poor practice. Always write out TRUE and FALSE R. Mark Sharp, Ph.D. msh...@txbiomed.org On Jun 24, 2015, at 1:26 PM, giacomo begnis gmbeg...@yahoo.it wrote: Hi, I have a dataset (728 obs) containing three variables code of a company, year and revenue. Some companies have a complete history of 5 years, others have not a complete history (for instance observations for three or four years).I would like to determine the companies with a complete history using a dummy variables.I have written the following program but there is somehting wrong because the dummy variable that I have create is always equal to zero.Can somebody help me?Thanks, gm z-read.table(file=c:/Rp/cddat.txt, sep=, header=T) attach(z) n-length(z$cod) // number of obs dataset d1-numeric(n) // dummy variable for (i in 5:n) { if (z$cod[i]==z$cod[i-4]) // cod is the code of a company { d1[i]=1} else { d1[i]=0} // d1=1 for a company with complete history, d1=0 if the history is not complete }d1 When I run the program d1 is always equal to zero. Why? Once I have create the dummy variable with subset I obtains the code of the companies with a complete history and finally with a merge I determine a panel of companies with a complete history.But how to determine correctly d1?My best regards, gm [[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] unlisting dplyr do output
I used the dplyr do function to apply a kernel regression smoother to a 3 column data table (grouping index, x, y) with about 7 M rows and 45000 groups. This runs quickly, about 1-2 minutes. It creates an data table (44,326 by 2) - grouping index, kernel smoothing output. The kernel smoothing output is a list of two element lists (x, smoothed y). I used a for loop to unlist this into a data table. for (i in 1:nrow(do object)) { df - bind_rows(list(df, data.frame(grouping index = do object[i], x = do object[[i]]$x, y = do object[[i]]$smoothed y))) } This takes about 100 minutes. Any guidance for a faster (more elegant?) solution will be appreciated. Nathan __ 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] time management graph
Maybe something like the punch cards on github? https://github.com/hadley/ggplot2/graphs/punch-card ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-24 16:33 GMT+02:00 PIKAL Petr petr.pi...@precheza.cz: Hi Thierry Thanks a lot. This is the option I found later. Still not 100% satisfactory. Maybe somebody did similar task and will have different opinion how to visualise such data. Jim’s gant diagrams are worth consideration so I will try to elaborate it further. Cheers Petr *From:* Thierry Onkelinx [mailto:thierry.onkel...@inbo.be] *Sent:* Wednesday, June 24, 2015 1:48 PM *To:* PIKAL Petr *Cc:* r-help@r-project.org *Subject:* Re: [R] time management graph Another option would be to use segments instead of lines. library(lubridate) temp$end - temp$time + minutes(temp$duration) library(ggplot2) ggplot(temp, aes(x=time, xend = end, y=Typ, yend = Typ, colour=person)) + geom_segment() ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-24 12:50 GMT+02:00 Jim Lemon drjimle...@gmail.com: Hi Petr, I'm not exactly sure this is what you are looking for, but try: start_indices-which(!is.na(temp$duration)) pp_gantt_info-list( labels=paste(as.character(temp$person[start_indices]), temp$Akce,temp$Typ,sep=-), starts=temp$time[start_indices], ends=temp$time[start_indices+1], require(plotrix) vgridpos-as.POSIXct(strptime( paste(2015-06-23 ,c(16,17,18,19,20,21,22,23),:00:00,sep=), format=%Y-%m-%d %H:%M:%S)) vgridlab-paste(c(16,17,18,19,20,21,22,23),:00,sep=) gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) Jim On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Dear all Did anybody tried to do time management graphs in R? I could do some aggregation xtabs(duration~person+Typ, data=temp) but I would like to make also a graph to show which task (Typ) and when was done by which person. The closest I came till this evening is following graph, but it is not exactly what I want. library(ggplot2) p-ggplot(temp, aes(x=time, y=Typ, colour=person)) p+geom_line() If anybody can focus me to proper functions or packages I would be greatful. Here are the data. temp - structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x), class = factor), Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, 6L, 7L, 4L, 4L), .Label = c(A, B, C, D, E, F, G, H), class = factor), person = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(One, Two), class = factor), time = structure(c(1435038600, 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, 1435038600, 1435039200, 1435039800, 1435040100,
Re: [R] Combining estimates from multiple regressions
Not an answer to your question, but you should not be using dummy variables in R. Use factors instead. Please read a R tutorial or text -- there are many -- to learn how to fit models in R. You might also wish to consult a local statistician or post on a statistics list like stats.stackexchange.com for statistics questions, which are off topic here. Further, when you post here, please read and follow the posting guide (below) and post in plain text, not HTML. Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Wed, Jun 24, 2015 at 3:27 AM, James Shaw sha...@gmail.com wrote: I am interested in using quantile regression to fit the following model at different quantiles of a response variable: (1) y = b0 + b1*g1 + b2*g2 + B*Z where b0 is an intercept, g1 and g2 are dummy variables for 2 of 3 independent groups, and Z is a matrix of covariates to be adjusted for in the estimation (e.g., age, gender). The problem is that estimates for g2 and g1 are not estimable at all quantiles. To overcome this, one option is to fit a separate model for each group (i.e., group 0, which is reflected by intercept above, group 1, and group 2): (2) y = b11 + B1*Z (model for group 0) (3) y = b12 + B2*Z (model for group 1) (4) y = b13 + B3*Z (model for group 2) This would correspond to fitting a single model in which group membership was interacted with all covariates, albeit some of the interaction terms would not be estimable for the reason noted above. However, I ultimately would like to base inferences on a single set of estimates. Can anyone suggest an approach to combine estimates from models (2)-(4), perhaps through weighted averaging, to generate estimates for the model presented in (1) above? An approach is not immediately clear to me since the group effects are subsumed in the intercepts in (2)-(4), whereas (1) includes separate estimates of group effects instead of a single weighted average. Regards, Jim [[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.
Re: [R] time management graph
Hi Thierry Thanks a lot. This is the option I found later. Still not 100% satisfactory. Maybe somebody did similar task and will have different opinion how to visualise such data. Jim’s gant diagrams are worth consideration so I will try to elaborate it further. Cheers Petr From: Thierry Onkelinx [mailto:thierry.onkel...@inbo.be] Sent: Wednesday, June 24, 2015 1:48 PM To: PIKAL Petr Cc: r-help@r-project.org Subject: Re: [R] time management graph Another option would be to use segments instead of lines. library(lubridate) temp$end - temp$time + minutes(temp$duration) library(ggplot2) ggplot(temp, aes(x=time, xend = end, y=Typ, yend = Typ, colour=person)) + geom_segment() ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-24 12:50 GMT+02:00 Jim Lemon drjimle...@gmail.commailto:drjimle...@gmail.com: Hi Petr, I'm not exactly sure this is what you are looking for, but try: start_indices-which(!is.nahttp://is.na(temp$duration)) pp_gantt_info-list( labels=paste(as.character(temp$person[start_indices]), temp$Akce,temp$Typ,sep=-), starts=temp$time[start_indices], ends=temp$time[start_indices+1], require(plotrix) vgridpos-as.POSIXct(strptime( paste(2015-06-23 ,c(16,17,18,19,20,21,22,23),:00:00,sep=), format=%Y-%m-%d %H:%M:%S)) vgridlab-paste(c(16,17,18,19,20,21,22,23),:00,sep=) gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) Jim On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr petr.pi...@precheza.czmailto:petr.pi...@precheza.cz wrote: Dear all Did anybody tried to do time management graphs in R? I could do some aggregation xtabs(duration~person+Typ, data=temp) but I would like to make also a graph to show which task (Typ) and when was done by which person. The closest I came till this evening is following graph, but it is not exactly what I want. library(ggplot2) p-ggplot(temp, aes(x=time, y=Typ, colour=person)) p+geom_line() If anybody can focus me to proper functions or packages I would be greatful. Here are the data. temp - structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x), class = factor), Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, 6L, 7L, 4L, 4L), .Label = c(A, B, C, D, E, F, G, H), class = factor), person = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(One, Two), class = factor), time = structure(c(1435038600, 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435065600, 1435068000), class = c(POSIXct, POSIXt), tzone = ), duration = c(10, 10, 5, 5, 6, 24, 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 60, 40, NA)), .Names = c(Akce, Typ, person, time, duration), class = data.frame, row.names = c(NA, -59L)) Best regards Petr Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny
Re: [R] time management graph
Hi Jim Thanks a lot. gantt.chart is worth trying, beside Thierry's segment solution. I need to think it over if it can be better for visualisation. Cheers Petr -Original Message- From: Jim Lemon [mailto:drjimle...@gmail.com] Sent: Wednesday, June 24, 2015 12:50 PM To: PIKAL Petr Cc: r-help@r-project.org Subject: Re: [R] time management graph Hi Petr, I'm not exactly sure this is what you are looking for, but try: start_indices-which(!is.na(temp$duration)) pp_gantt_info-list( labels=paste(as.character(temp$person[start_indices]), temp$Akce,temp$Typ,sep=-), starts=temp$time[start_indices], ends=temp$time[start_indices+1], require(plotrix) vgridpos-as.POSIXct(strptime( paste(2015-06-23 ,c(16,17,18,19,20,21,22,23),:00:00,sep=), format=%Y-%m-%d %H:%M:%S)) vgridlab-paste(c(16,17,18,19,20,21,22,23),:00,sep=) gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) Jim On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Dear all Did anybody tried to do time management graphs in R? I could do some aggregation xtabs(duration~person+Typ, data=temp) but I would like to make also a graph to show which task (Typ) and when was done by which person. The closest I came till this evening is following graph, but it is not exactly what I want. library(ggplot2) p-ggplot(temp, aes(x=time, y=Typ, colour=person)) p+geom_line() If anybody can focus me to proper functions or packages I would be greatful. Here are the data. temp - structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x), class = factor), Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, 6L, 7L, 4L, 4L), .Label = c(A, B, C, D, E, F, G, H), class = factor), person = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(One, Two), class = factor), time = structure(c(1435038600, 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435065600, 1435068000), class = c(POSIXct, POSIXt), tzone = ), duration = c(10, 10, 5, 5, 6, 24, 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 60, 40, NA)), .Names = c(Akce, Typ, person, time, duration), class = data.frame, row.names = c(NA, -59L)) Best regards Petr Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s
Re: [R] R lattice : labeling of matrix groups of different size with strips
Hi I am not sure what you want plotMatrix , , group1 a b c d 1 1 0 0 0 2 1 0 0 0 3 1 1 0 0 4 0 1 0 0 5 0 1 1 0 , , group2 a b c d 1 0 0 1 0 2 0 0 1 1 3 0 0 0 1 4 NA NA NA NA 5 NA NA NA NA If you do not want to show the NA's without giving them a different colour then here is a cludgy way of doing things print( levelplot(plotMatrix[1:3,,2], page = function(n){ grid.text(paste(group2), x = 0.5, y = 0.96, default.units = npc, just = c(left, bottom), gp = gpar(fontsize = 12) ) }, colorkey = F, xlab = , ylab=), position = c(0.2,0,0.8,0.5), more = TRUE) print( levelplot(plotMatrix[,,1], page = function(n){ grid.text(paste(group1), x = 0.5, y = 0.96, default.units = npc, just = c(left, bottom), gp = gpar(fontsize = 12) ) }, colorkey = F, xlab = , ylab=), position = c(0,0.5,1,1), more = FALSE) It will depend on your device so you will have to amend the position settings of group n and size of plots. using the page argument saves having to do a panel function If you wanted to have the strip that is a different matter Regards Duncan PS Does this suit? library(latticeExtra) c(levelplot(plotMatrix[,,1],colorkey=F,xlab=,ylab=),levelplot(plotMatrix[1:3,,2],colorkey=F,xlab=,ylab=)) just using the defaults. have not got time to explore further you may have to annotate groups by grid.text with or without trellis.focus Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of R codeplayer Sent: Wednesday, 24 June 2015 23:10 To: r-help@r-project.org Subject: [R] R lattice : labeling of matrix groups of different size with strips In R lattice, I am trying to label predefined groups of rows in a matrix of data with strips. Currently, the length of the strips fail to match the different sizes of the groups as the data representation only allows groups with the same size. One possibility to solve this might be to suppress the display of NAs, but I did not find any configuration to realize this in Lattice. The example code below shows a matrix (m) with 8 rows and 4 columns. Group 1 contains row 1-5 and group 2 contains row 6-8. The lattice output is attached below the code. Thank you for your time library(lattice) m - matrix(c(1,1,1,0,0,0,0,0, 0,0,1,1,1,0,0,0, 0,0,0,0,1,1,1,0, 0,0,0,0,0,0,1,1),nrow=8,ncol=4) group1 - m[1:5,] group2 - m[6:nrow(m),] plotMatrix - array(dim=c(5,4,2)) dimnames(plotMatrix) - list(rep(,5), c(a,b,c,d),c(group1,group2)) plotMatrix[,,1]- group1 plotMatrix[1:3,,2] - group2 trellis.device(device = pdf,file =lattice_strips.pdf,width=14,height=10) print(levelplot(plotMatrix,colorkey=F,xlab=,ylab=)) dev.off() __ 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] Draw maps on arbitrary Projections
The easiest way is to find out what the actual projection is, and reconstruct a sensible representation of the grid. Usually you have to guess, but it's possible to figure out. You *can* plot by building a proper mesh in longlat, but my preference is full rescue. You need to know the projection and its particulars, i.e. google suggests its Lambert Conformal Conic but you also need datum/ellipsoid, standard parallels, and central longitude/latitude at a minimum. If you can point to an actual example and some trail of where it came from someone could help. Also, R-Sig-Geo is a specialized mailing list for this stuff. Cheers, Mike. On Thu, 25 Jun 2015 at 06:08 Florian Losch m...@florianlosch.de wrote: I have spatial data from the WRF-model. I don't know what kind of projection was used to produce these data (neither longitude nor latitude are constant at any borders), but I have 2D matrixes for each longitude and latitude. The area covered is North America. How can I add a map using these 2D matrixes? -- View this message in context: http://r.789695.n4.nabble.com/Draw-maps-on-arbitrary-Projections-tp4709014.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. [[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] Combining estimates from multiple regressions
Thanks for the suggestions, Gunter. On Wed, Jun 24, 2015 at 10:33 AM, Bert Gunter bgunter.4...@gmail.com wrote: Not an answer to your question, but you should not be using dummy variables in R. Use factors instead. Please read a R tutorial or text -- there are many -- to learn how to fit models in R. You might also wish to consult a local statistician or post on a statistics list like stats.stackexchange.com for statistics questions, which are off topic here. Further, when you post here, please read and follow the posting guide (below) and post in plain text, not HTML. Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Wed, Jun 24, 2015 at 3:27 AM, James Shaw sha...@gmail.com wrote: I am interested in using quantile regression to fit the following model at different quantiles of a response variable: (1) y = b0 + b1*g1 + b2*g2 + B*Z where b0 is an intercept, g1 and g2 are dummy variables for 2 of 3 independent groups, and Z is a matrix of covariates to be adjusted for in the estimation (e.g., age, gender). The problem is that estimates for g2 and g1 are not estimable at all quantiles. To overcome this, one option is to fit a separate model for each group (i.e., group 0, which is reflected by intercept above, group 1, and group 2): (2) y = b11 + B1*Z (model for group 0) (3) y = b12 + B2*Z (model for group 1) (4) y = b13 + B3*Z (model for group 2) This would correspond to fitting a single model in which group membership was interacted with all covariates, albeit some of the interaction terms would not be estimable for the reason noted above. However, I ultimately would like to base inferences on a single set of estimates. Can anyone suggest an approach to combine estimates from models (2)-(4), perhaps through weighted averaging, to generate estimates for the model presented in (1) above? An approach is not immediately clear to me since the group effects are subsumed in the intercepts in (2)-(4), whereas (1) includes separate estimates of group effects instead of a single weighted average. Regards, Jim [[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.
Re: [R] set par options once for entire R session
The Details section of ?par starts of with: Each device has its own set of graphical parameters. (So this is not Mac-specific.) Strictly speaking, the options you set with par() are not reset when you open a new graphics device. Rather, when a new device is opened, it is initialized with default values of graphics parameters. If you can find where those default values are stored (in a brief search I did not find them), then perhaps you can change them at session startup time. I haven't tested this, but you might be able to make things a little more convenient by defining a function mypar - function() par( {set whatever values you want} ) Then whenever you open a new device, immediately call that function: pdf() mypar() plot(x,y) dev.off() png() mypar() plot(x,y) dev.of() And so on. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 6/23/15, 8:54 AM, R-help on behalf of Martin Batholdy via R-help r-help-boun...@r-project.org on behalf of r-help@r-project.org wrote: Hi, I would like to set plot-options via par() and keep them for all plots that are created thereafter. Currently after each plot device the parameters I can set with par() are reseted to their default value, at least on a Mac (R 3.2.1). Is there a way to define the parameters for plotting once at the beginning and then keep them for an entire R session? Thank you! __ 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.
Re: [R] Rcpp cpp11 and R CMD build
Hi Edwin, If you look at the build output you will notice that the C++11 compiler flag is not being used. I just created a small package using Rcpp11 and your function and it worked without a problem. I can't give you a specific reason without seeing your package but there are some possibilities I would guess right away. 1. Make sure you are 'LinkingTo' Rcpp11 in your DESCRIPTION 2. Unless you are using some custom Makevars file, you should set 'SystemRequirements: C++11' in your DESCRIPTION Charles On Wed, Jun 24, 2015 at 10:07 AM, Edwin van Leeuwen edwinv...@gmail.com wrote: Hi all, I've just started using Rcpp and am trying to get cpp11 support working. As suggested I added [[Rcpp:plugins(cpp11)]] to my source file and a test function: // [[Rcpp::export]] int useCpp11() { auto x = 10; return x; } This works fine when using: sourceCpp(filename) from R, but I would like to be able to compile the package from the command line. R CMD build mypackage fails with the following error: R CMD build ../fluEvidenceSynthesis * checking for file ‘../fluEvidenceSynthesis/DESCRIPTION’ ... OK * preparing ‘fluEvidenceSynthesis’: * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package to process help pages --- * installing *source* package ‘fluEvidenceSynthesis’ ... ** libs g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c rcpp_hello_world.cpp -o rcpp_hello_world.o rcpp_hello_world.cpp: In function ‘int useCpp11()’: rcpp_hello_world.cpp:33:10: error: ‘x’ does not name a type auto x = 10; ^ rcpp_hello_world.cpp:34:12: error: ‘x’ was not declared in this scope return x; ^ make: *** [rcpp_hello_world.o] Error 1 ERROR: compilation failed for package ‘fluEvidenceSynthesis’ * removing ‘/tmp/RtmpWdUduu/Rinst2b601aa285e9/fluEvidenceSynthesis’ --- ERROR: package installation failed Any help appreciated. Cheers, Edwin [[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. [[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] Rcpp cpp11 and R CMD build
Hi all, I've just started using Rcpp and am trying to get cpp11 support working. As suggested I added [[Rcpp:plugins(cpp11)]] to my source file and a test function: // [[Rcpp::export]] int useCpp11() { auto x = 10; return x; } This works fine when using: sourceCpp(filename) from R, but I would like to be able to compile the package from the command line. R CMD build mypackage fails with the following error: R CMD build ../fluEvidenceSynthesis * checking for file ‘../fluEvidenceSynthesis/DESCRIPTION’ ... OK * preparing ‘fluEvidenceSynthesis’: * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package to process help pages --- * installing *source* package ‘fluEvidenceSynthesis’ ... ** libs g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c rcpp_hello_world.cpp -o rcpp_hello_world.o rcpp_hello_world.cpp: In function ‘int useCpp11()’: rcpp_hello_world.cpp:33:10: error: ‘x’ does not name a type auto x = 10; ^ rcpp_hello_world.cpp:34:12: error: ‘x’ was not declared in this scope return x; ^ make: *** [rcpp_hello_world.o] Error 1 ERROR: compilation failed for package ‘fluEvidenceSynthesis’ * removing ‘/tmp/RtmpWdUduu/Rinst2b601aa285e9/fluEvidenceSynthesis’ --- ERROR: package installation failed Any help appreciated. Cheers, Edwin [[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] R lattice : labeling of matrix groups of different size with strips
In R lattice, I am trying to label predefined groups of rows in a matrix of data with strips. Currently, the length of the strips fail to match the different sizes of the groups as the data representation only allows groups with the same size. One possibility to solve this might be to suppress the display of NAs, but I did not find any configuration to realize this in Lattice. The example code below shows a matrix (m) with 8 rows and 4 columns. Group 1 contains row 1-5 and group 2 contains row 6-8. The lattice output is attached below the code. Thank you for your time library(lattice) m - matrix(c(1,1,1,0,0,0,0,0, 0,0,1,1,1,0,0,0, 0,0,0,0,1,1,1,0, 0,0,0,0,0,0,1,1),nrow=8,ncol=4) group1 - m[1:5,] group2 - m[6:nrow(m),] plotMatrix - array(dim=c(5,4,2)) dimnames(plotMatrix) - list(rep(,5), c(a,b,c,d),c(group1,group2)) plotMatrix[,,1]- group1 plotMatrix[1:3,,2] - group2 trellis.device(device = pdf,file =lattice_strips.pdf,width=14,height=10) print(levelplot(plotMatrix,colorkey=F,xlab=,ylab=)) dev.off() lattice_strips.pdf Description: Adobe PDF document __ 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] create a dummy variables for companies with complete history.
Hi, I have a dataset (728 obs) containing three variables code of a company, year and revenue. Some companies have a complete history of 5 years, others have not a complete history (for instance observations for three or four years).I would like to determine the companies with a complete history using a dummy variables.I have written the following program but there is somehting wrong because the dummy variable that I have create is always equal to zero.Can somebody help me?Thanks, gm z-read.table(file=c:/Rp/cddat.txt, sep=, header=T) attach(z) n-length(z$cod) // number of obs dataset d1-numeric(n) // dummy variable for (i in 5:n) { if (z$cod[i]==z$cod[i-4]) // cod is the code of a company { d1[i]=1} else { d1[i]=0} // d1=1 for a company with complete history, d1=0 if the history is not complete }d1 When I run the program d1 is always equal to zero. Why? Once I have create the dummy variable with subset I obtains the code of the companies with a complete history and finally with a merge I determine a panel of companies with a complete history.But how to determine correctly d1?My best regards, gm [[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] Lavaan
i tried the semPlot but it flopped. various other packages also did not perform. i will try the DiagrammeR package and revert. meanwhile, i tried going to the onyx package and its neat, though i have yet to spend some time on it to familiarise myself with the nuts and bolts of the process. ** *Deva* *F-13* *iResearch@NITIE* *my 'research engine' * ... *in search of knowledge, everyday something is added * *in search of wisdom, everyday something is dropped ... an old Chinese Proverb* : On Wed, Jun 24, 2015 at 6:32 PM, Rick Bilonick ra...@pitt.edu wrote: Have you considered using the semPlot package? It works nicely with lavaan models (among other sem packages). There is also the DiagrammeR package. Rick On 06/23/2015 10:48 AM, DzR wrote: Dear Senior users of R/R Studio, I am very new to this environment hence am unable to plot the SEM models including use of graphic package ggplot. Request for some help in getting the plots please. Thanks, - Deva __ 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. -- Richard A. Bilonick, PhD Assistant Professor Dept. of Ophthalmology, School of Medicine Dept. of Biostatistics, Graduate School of Public Health Dept. of Orthodontics, School of Dental Medicine University of Pittsburgh Principal Investigator for the Pittsburgh Aerosol Research and Inhalation Epidemiology Study (PARIES) 412 647 5756 __ 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.
[R] Broken links (???) in rw-FAQ
Could you also kindly check the following links in the rw-FAQ manual at http://cran.r-project.org/bin/windows/base/rw-FAQ.html?? The links list in the below seem to be broken. I hope these links are fixed in the very near future. Under the section 2.4 Can I customize the installation? * Setup (http://jrsoftware.org/ishelp.php) for details. Under the section 3.3 I want to run R in Chinese/Japanese/Korean * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_language_and_country_strings.asp Under the section 2.26 There is no tilde on my keyboard! * http://office.microsoft.com/en-us/word/HP052590631033.aspx This link is in fact moved to https://support.office.com/en-us/article/HP052590631?CorrelationId=98eaa529-e95a-4628-90ac-1a1da4526b17 Under the section 2.24 Does R run under Windows Vista/7/8/Server 2008? * http://windowsvistablog.com/blogs/windowsvista/archive/2007/01/23/security-features-vs-convenience.aspx I appreciate your help! Chel Hee Lee __ 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] Rcpp cpp11 and R CMD build
Glad to help, The SystemRequirements is for a package. I believe the example in the gallery is intended to demonstrate a function where if you set the CXX_FLAGS with: Sys.setenv(PKG_CXXFLAGS=-std=c++11) And then compiled a single *.cpp file with Rcpp::sourceCpp(test.cpp) I believe it should work fine. But for package purposes you want the user to not have to care about setting flags manually. It ultimately just comes down to context. Regards, Charles On Wed, Jun 24, 2015 at 11:57 AM, Edwin van Leeuwen edwinv...@gmail.com wrote: Thank you! I was missing the SystemRequirements. I guess it could be useful to add this to the example given here: http://gallery.rcpp.org/articles/simple-lambda-func-c++11/ Cheers, Edwin On Wed, 24 Jun 2015 at 17:50 Charles Determan cdeterma...@gmail.com wrote: Hi Edwin, If you look at the build output you will notice that the C++11 compiler flag is not being used. I just created a small package using Rcpp11 and your function and it worked without a problem. I can't give you a specific reason without seeing your package but there are some possibilities I would guess right away. 1. Make sure you are 'LinkingTo' Rcpp11 in your DESCRIPTION 2. Unless you are using some custom Makevars file, you should set 'SystemRequirements: C++11' in your DESCRIPTION Charles On Wed, Jun 24, 2015 at 10:07 AM, Edwin van Leeuwen edwinv...@gmail.com wrote: Hi all, I've just started using Rcpp and am trying to get cpp11 support working. As suggested I added [[Rcpp:plugins(cpp11)]] to my source file and a test function: // [[Rcpp::export]] int useCpp11() { auto x = 10; return x; } This works fine when using: sourceCpp(filename) from R, but I would like to be able to compile the package from the command line. R CMD build mypackage fails with the following error: R CMD build ../fluEvidenceSynthesis * checking for file ‘../fluEvidenceSynthesis/DESCRIPTION’ ... OK * preparing ‘fluEvidenceSynthesis’: * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package to process help pages --- * installing *source* package ‘fluEvidenceSynthesis’ ... ** libs g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c rcpp_hello_world.cpp -o rcpp_hello_world.o rcpp_hello_world.cpp: In function ‘int useCpp11()’: rcpp_hello_world.cpp:33:10: error: ‘x’ does not name a type auto x = 10; ^ rcpp_hello_world.cpp:34:12: error: ‘x’ was not declared in this scope return x; ^ make: *** [rcpp_hello_world.o] Error 1 ERROR: compilation failed for package ‘fluEvidenceSynthesis’ * removing ‘/tmp/RtmpWdUduu/Rinst2b601aa285e9/fluEvidenceSynthesis’ --- ERROR: package installation failed Any help appreciated. Cheers, Edwin [[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. [[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] Broken links (???) in R-FAQ
Could you kindly check if the following links are working fine in the R-FAQ page at http://cran.r-project.org/doc/FAQ/R-FAQ.html? The links listed in the below seem to be broken. I hope these links are fixed in the very near future. Under the section 2.6 Are there Unix-like binaries for R?, * http://CRAN.R-project.org/bin/linux/debian/README Under the section 2.10 What is CRAN?, * http://cran.au.R-project.org/ * http://cran.pt.R-project.org/ Under the section 2.14 What is R-Forge?, * GForge www.gforge.org Under the section 3.1 What is S?, * http://cm.bell-labs.com/cm/ms/departments/sia/Sbook/ * http://cm.bell-labs.com/cm/ms/departments/sia/S/history.html Under the section 4 R Web Interfaces, * http://rwiki.sciviews.org/doku.php?id=faq-r#web_interfaces * Rserve http://stats.math.uni-augsburg.de/Rserve/ Under the section 5.1.4 Add-on packages from Bioconductor, * Bioconductor software packages http://www.bioconductor.org/packages/bioc/ Under the section 7.39 How do I create a plot with two y-axes?, * http://rwiki.sciviews.org/doku.php?id=tips:graphics-base:2yaxes I appreciate your helps! Chel Hee Lee __ 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] repeated measures: multiple comparisons with pairwise.t.test and multcomp disagree
I would **strongly** recommend that you speak with a local statistical expert before proceeding further. Your obsession with statistical significance is very dangerous. (see the current issue of SIGNIFICANCE for some explanation). Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Wed, Jun 24, 2015 at 10:30 AM, Denis Chabot denis.cha...@me.com wrote: Thank you, Thierry. And yes, Bert, it turns out that it is more of a statistical question after all, but again, since my question used specific R functions, R experts are well placed to help me. As pairewise.t.test was recommended in a few tutorials about repeated-measure Anovas, I assumed it took into account the fact that the measures were indeed repeated, so thank you for pointing out that it does not. But my reason for not accepting the result of multcomp went further than this. Before deciding to test 4 different durations, I had tested only two of them, corresponding to sets 1 and 2 of my example. I used a paired t test (as in t test for paired samples). I had a very significant effect, i.e. the mean of the differences calculated for each subject was significantly different from zero. After adding two other durations and switching from my paired t test to a repeated measures design, these same 2 sets are no longer different. I think the explanation is lack of homogeneity of variances. I thought a log transformation of the raw data had been sufficient to fix this, and a Levene test on the variances of the 4 sets found no problem in this regard. But maybe it is the variance of all the possible differences (set 1 vs 2, etc, for a total of 6 differences calculated for each subject) that matters. I just calculated these and they range from 1.788502e-05 to 1.462171e-03. A Levene test on these 6 groups showed that their variances were heterogeneous. I think I'll stay away from the repeated measures followed by multiple comparisons and just report my 6 t tests for paired samples, correcting the p-level for the number of comparisons with, say, the Sidak method (p for significance is then 0.0085). Thanks for your help. Denis Le 2015-06-23 à 08:15, Thierry Onkelinx thierry.onkel...@inbo.be a écrit : Dear Denis, It's not multcomp which is too conservative, it is the pairwise t-test which is too liberal. The pairwise t-test doesn't take the random effect of Case into account. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-23 5:17 GMT+02:00 Denis Chabot denis.cha...@me.com: Hi, I am working on a problem which I think can be handled as a repeated measures analysis, and I have read many tutorials about how to do this with R. This part goes well, but I get stuck with the multiple comparisons I'd like to run afterward. I tried two methods that I have seen in my readings, but their results are quite different and I don't know which one to trust. The two approaches are pairwise.t.test() and multcomp, although the latter is not available after a repeated-measures aov model, but it is after a lme. I have a physiological variable measured frequently on each of 67 animals. These are then summarized with a quantile for each animal. To check the effect of experiment duration, I recalculated the quantile for each animal 4 times, using different subset of the data (so the shortest subset is part of all other subsets, the second subset is included in the 2 others, etc.). I handle this as 4 repeated (non-independent) measurements for each animal, and want to see if the average value (for 67 animals) differs for the 4 different durations. Because animals with high values for this physiological trait have larger differences between the 4 durations than animals with low values, the observations were log transformed. I attach the small data set (Rda format) here, but it can be obtained here if the attachment gets stripped: https://dl.dropboxusercontent.com/u/612902/RepMeasData.Rda The data.frame is simply called Data. My code is load(RepMeasData.Rda) Data_Long = melt(Data, id=Case) names(Data_Long) = c(Case,Duration, SMR) Data_Long$SMR = log10(Data_Long$SMR) # I only show essential code to reproduce my opposing results mixmod = lme(SMR ~ Duration, data =
Re: [R] create a dummy variables for companies with complete history.
Please repost your question in plain text rather than HTML - you can see below that your code got rather mangled. Please also include some sample data using dput() - made-up data of similar form is fine, but it's very hard to answer a question based on guessing what the data look like. Sarah On Wed, Jun 24, 2015 at 2:26 PM, giacomo begnis gmbeg...@yahoo.it wrote: Hi, I have a dataset (728 obs) containing three variables code of a company, year and revenue. Some companies have a complete history of 5 years, others have not a complete history (for instance observations for three or four years).I would like to determine the companies with a complete history using a dummy variables.I have written the following program but there is somehting wrong because the dummy variable that I have create is always equal to zero.Can somebody help me?Thanks, gm z-read.table(file=c:/Rp/cddat.txt, sep=, header=T) attach(z) n-length(z$cod) // number of obs dataset d1-numeric(n) // dummy variable for (i in 5:n) { if (z$cod[i]==z$cod[i-4]) // cod is the code of a company { d1[i]=1} else { d1[i]=0} // d1=1 for a company with complete history, d1=0 if the history is not complete }d1 When I run the program d1 is always equal to zero. Why? Once I have create the dummy variable with subset I obtains the code of the companies with a complete history and finally with a merge I determine a panel of companies with a complete history.But how to determine correctly d1?My best regards, gm [[alternative HTML version deleted]] -- Sarah Goslee http://www.functionaldiversity.org __ 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] create a dummy variables for companies with complete history.
Comments below On 24/06/2015 19:26, giacomo begnis wrote: Hi, I have a dataset (728 obs) containing three variables code of a company, year and revenue. Some companies have a complete history of 5 years, others have not a complete history (for instance observations for three or four years).I would like to determine the companies with a complete history using a dummy variables.I have written the following program but there is somehting wrong because the dummy variable that I have create is always equal to zero.Can somebody help me?Thanks, gm z-read.table(file=c:/Rp/cddat.txt, sep=, header=T) attach(z) n-length(z$cod) // number of obs dataset Could also use nrow(z) d1-numeric(n) // dummy variable for (i in 5:n) { if (z$cod[i]==z$cod[i-4]) // cod is the code of a company { d1[i]=1} else { d1[i]=0} // d1=1 for a company with complete history, d1=0 if the history is not complete }d1 Did you really type = which means less than or equals to? If so, try replacing it with - and see what happens. When I run the program d1 is always equal to zero. Why? Once I have create the dummy variable with subset I obtains the code of the companies with a complete history and finally with a merge I determine a panel of companies with a complete history.But how to determine correctly d1?My best regards, gm [[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.
Re: [R] Rcpp cpp11 and R CMD build
Thank you! I was missing the SystemRequirements. I guess it could be useful to add this to the example given here: http://gallery.rcpp.org/articles/simple-lambda-func-c++11/ Cheers, Edwin On Wed, 24 Jun 2015 at 17:50 Charles Determan cdeterma...@gmail.com wrote: Hi Edwin, If you look at the build output you will notice that the C++11 compiler flag is not being used. I just created a small package using Rcpp11 and your function and it worked without a problem. I can't give you a specific reason without seeing your package but there are some possibilities I would guess right away. 1. Make sure you are 'LinkingTo' Rcpp11 in your DESCRIPTION 2. Unless you are using some custom Makevars file, you should set 'SystemRequirements: C++11' in your DESCRIPTION Charles On Wed, Jun 24, 2015 at 10:07 AM, Edwin van Leeuwen edwinv...@gmail.com wrote: Hi all, I've just started using Rcpp and am trying to get cpp11 support working. As suggested I added [[Rcpp:plugins(cpp11)]] to my source file and a test function: // [[Rcpp::export]] int useCpp11() { auto x = 10; return x; } This works fine when using: sourceCpp(filename) from R, but I would like to be able to compile the package from the command line. R CMD build mypackage fails with the following error: R CMD build ../fluEvidenceSynthesis * checking for file ‘../fluEvidenceSynthesis/DESCRIPTION’ ... OK * preparing ‘fluEvidenceSynthesis’: * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package to process help pages --- * installing *source* package ‘fluEvidenceSynthesis’ ... ** libs g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o g++ -I/usr/share/R/include -DNDEBUG -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c rcpp_hello_world.cpp -o rcpp_hello_world.o rcpp_hello_world.cpp: In function ‘int useCpp11()’: rcpp_hello_world.cpp:33:10: error: ‘x’ does not name a type auto x = 10; ^ rcpp_hello_world.cpp:34:12: error: ‘x’ was not declared in this scope return x; ^ make: *** [rcpp_hello_world.o] Error 1 ERROR: compilation failed for package ‘fluEvidenceSynthesis’ * removing ‘/tmp/RtmpWdUduu/Rinst2b601aa285e9/fluEvidenceSynthesis’ --- ERROR: package installation failed Any help appreciated. Cheers, Edwin [[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. [[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] repeated measures: multiple comparisons with pairwise.t.test and multcomp disagree
Thank you, Thierry. And yes, Bert, it turns out that it is more of a statistical question after all, but again, since my question used specific R functions, R experts are well placed to help me. As pairewise.t.test was recommended in a few tutorials about repeated-measure Anovas, I assumed it took into account the fact that the measures were indeed repeated, so thank you for pointing out that it does not. But my reason for not accepting the result of multcomp went further than this. Before deciding to test 4 different durations, I had tested only two of them, corresponding to sets 1 and 2 of my example. I used a paired t test (as in t test for paired samples). I had a very significant effect, i.e. the mean of the differences calculated for each subject was significantly different from zero. After adding two other durations and switching from my paired t test to a repeated measures design, these same 2 sets are no longer different. I think the explanation is lack of homogeneity of variances. I thought a log transformation of the raw data had been sufficient to fix this, and a Levene test on the variances of the 4 sets found no problem in this regard. But maybe it is the variance of all the possible differences (set 1 vs 2, etc, for a total of 6 differences calculated for each subject) that matters. I just calculated these and they range from 1.788502e-05 to 1.462171e-03. A Levene test on these 6 groups showed that their variances were heterogeneous. I think I'll stay away from the repeated measures followed by multiple comparisons and just report my 6 t tests for paired samples, correcting the p-level for the number of comparisons with, say, the Sidak method (p for significance is then 0.0085). Thanks for your help. Denis Le 2015-06-23 à 08:15, Thierry Onkelinx thierry.onkel...@inbo.be a écrit : Dear Denis, It's not multcomp which is too conservative, it is the pairwise t-test which is too liberal. The pairwise t-test doesn't take the random effect of Case into account. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-23 5:17 GMT+02:00 Denis Chabot denis.cha...@me.com: Hi, I am working on a problem which I think can be handled as a repeated measures analysis, and I have read many tutorials about how to do this with R. This part goes well, but I get stuck with the multiple comparisons I'd like to run afterward. I tried two methods that I have seen in my readings, but their results are quite different and I don't know which one to trust. The two approaches are pairwise.t.test() and multcomp, although the latter is not available after a repeated-measures aov model, but it is after a lme. I have a physiological variable measured frequently on each of 67 animals. These are then summarized with a quantile for each animal. To check the effect of experiment duration, I recalculated the quantile for each animal 4 times, using different subset of the data (so the shortest subset is part of all other subsets, the second subset is included in the 2 others, etc.). I handle this as 4 repeated (non-independent) measurements for each animal, and want to see if the average value (for 67 animals) differs for the 4 different durations. Because animals with high values for this physiological trait have larger differences between the 4 durations than animals with low values, the observations were log transformed. I attach the small data set (Rda format) here, but it can be obtained here if the attachment gets stripped: https://dl.dropboxusercontent.com/u/612902/RepMeasData.Rda The data.frame is simply called Data. My code is load(RepMeasData.Rda) Data_Long = melt(Data, id=Case) names(Data_Long) = c(Case,Duration, SMR) Data_Long$SMR = log10(Data_Long$SMR) # I only show essential code to reproduce my opposing results mixmod = lme(SMR ~ Duration, data = Data_Long, random = ~ 1 | Case) anova(mixmod) posthoc - glht(mixmod, linfct = mcp(Duration = Tukey)) summary(posthoc) Simultaneous Tests for General Linear Hypotheses Multiple Comparisons of Means: Tukey Contrasts Fit: lme.formula(fixed = SMR ~ Duration, data = Data_Long, random = ~1 | Case) Linear Hypotheses: Estimate Std. Error z value Pr(|z|) Set2 - Set1 == 0 -0.006135 0.003375 -1.8180.265 Set3 - Set1 == 0 -0.002871
[R] Draw maps on arbitrary Projections
I have spatial data from the WRF-model. I don't know what kind of projection was used to produce these data (neither longitude nor latitude are constant at any borders), but I have 2D matrixes for each longitude and latitude. The area covered is North America. How can I add a map using these 2D matrixes? -- View this message in context: http://r.789695.n4.nabble.com/Draw-maps-on-arbitrary-Projections-tp4709014.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] Plotting legend outside of chart area
Hello, I am trying to add a legend to my PCA plot so that it looks neat. I think plotting this outside of the chart area would be good but I cannot seem to fathom the correct code for this. I wondered if anyone could help please? The code I am using is as follows: grp- with(Matan, cut(R_category_no,14, labels=1:14)) cols - c(grey0, wheat, red, cyan, orange, darkolivegreen2, purple3, royalblue, burlywood4, orchid, forestgreen, green, gray, yellow1) plot(geopca, display=sites, scaling=3, type=n) points(geopca, display=sites, scaling=3, col=cols[grp], pch=16) legend(bottomright, col=c(grey0, wheat, red, cyan, orange, darkolivegreen2, purple3, royalblue, burlywood4, orchid, forestgreen, green, gray, yellow1), c(Control type 1, Control type 2, External/Courtyard, Midden, Animal Occupation, External fire installations and ashy deposits, Internal fire installations and ashy deposits, Hearth make-up, Floors and surfaces, Plasters and clay features, Storage features, Platforms and benches, Mortars, Roofs and roofing materials), pch=16, cex=0.75, bty=n) Thank you for your time in advance Dr Samantha Lee Allcock Faculty of Science and Technology Department of Archaeology, Anthropology and Forensic Science Christchurch House Rm: C133 Bournemouth University Talbot Campus Poole BH12 5BB Tel: 01202 9(62474) sallc...@bournemouth.ac.ukmailto:sallc...@bournemouth.ac.uk research.bournemouth.ac.uk/2014/07/inea-project-2 BU is a Disability Two Ticks Employer and has signed up to the Mindful Employer charter. Information about the accessibility of University buildings can be found on the BU DisabledGo webpages This email is intended only for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email, which must not be copied, distributed or disclosed to any other person. Any views or opinions presented are solely those of the author and do not necessarily represent those of Bournemouth University or its subsidiary companies. Nor can any contract be formed on behalf of the University or its subsidiary companies via email. [[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] Read large '.csv' files from zipped file
Hi all, I use ireadLines function to iterate large '.csv' files from '.zip' file. When I execute the nextElem function in R console, I can only fetch the first line of file content no matter how many times . Example code show as bellow. library(iterators) con-unz(description='g:\\hourly_WIND_2013.zip',filename='hourly_WIND_2013.csv') it-ireadLines(con) nextElem(it) [1] \State Code\,\County Code\,\Site Num\,\Parameter Code\,\POC\,\Latitude\,\Longitude\,\Datum\,\Parameter Name\,\Date Local\,\Time Local\,\Date GMT\,\Time GMT\,\Sample Measurement\,\Units of Measure\,\MDL\,\Uncertainty\,\Qualifier\,\Method Type\,\Method Name\,\State Name\,\County Name\,\Date of Last Change\ nextElem(it) [1] \State Code\,\County Code\,\Site Num\,\Parameter Code\,\POC\,\Latitude\,\Longitude\,\Datum\,\Parameter Name\,\Date Local\,\Time Local\,\Date GMT\,\Time GMT\,\Sample Measurement\,\Units of Measure\,\MDL\,\Uncertainty\,\Qualifier\,\Method Type\,\Method Name\,\State Name\,\County Name\,\Date of Last Change\ Can anybody tell me what did i missed? Regards Jianwen Luo [[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] Need some help with converting MATLAB .m script to R
Hello, I have few scripts that have been written in MATLAB. I need to translate or convert them into R. They all deal with reading in a netcdf file and doing some plots. I managed to read in the netcdf file with these API calls # Read input file input_dir = /home/aan/aa/data/r file = RRR input_file = file.path(input_dir,file) library(ncdf4) Upto this everything works. Here is the MATLAB code for which I need help % Plot continental boundaries (rotated latitude/longitude) figure; inp.COAST_RLON.data ( inp.COAST_RLON.data -900 ) = NaN; inp.COAST_RLAT.data ( inp.COAST_RLAT.data -900 ) = NaN; plot(inp.COAST_RLON.data,inp.COAST_RLAT.data,'k'); Regards, Ashwin. [[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] Plotting legend outside of chart area
Tena koe Samantha You probably need to set some graphics parameters such as xpd and mar (see ?par), and then give the × and y location of the legend rather than 'bottomright' (see ?legend). HTH Peter Alspach PS Please don't post in html (see the posting guide) ... P -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Samantha Allcock Sent: Thursday, 25 June 2015 4:35 a.m. To: 'r-help@r-project.org' Subject: [R] Plotting legend outside of chart area Hello, I am trying to add a legend to my PCA plot so that it looks neat. I think plotting this outside of the chart area would be good but I cannot seem to fathom the correct code for this. I wondered if anyone could help please? The code I am using is as follows: grp- with(Matan, cut(R_category_no,14, labels=1:14)) cols - c(grey0, wheat, red, cyan, orange, darkolivegreen2, purple3, royalblue, burlywood4, orchid, forestgreen, green, gray, yellow1) plot(geopca, display=sites, scaling=3, type=n) points(geopca, display=sites, scaling=3, col=cols[grp], pch=16) legend(bottomright, col=c(grey0, wheat, red, cyan, orange, darkolivegreen2, purple3, royalblue, burlywood4, orchid, forestgreen, green, gray, yellow1), c(Control type 1, Control type 2, External/Courtyard, Midden, Animal Occupation, External fire installations and ashy deposits, Internal fire installations and ashy deposits, Hearth make-up, Floors and surfaces, Plasters and clay features, Storage features, Platforms and benches, Mortars, Roofs and roofing materials), pch=16, cex=0.75, bty=n) Thank you for your time in advance Dr Samantha Lee Allcock Faculty of Science and Technology Department of Archaeology, Anthropology and Forensic Science Christchurch House Rm: C133 Bournemouth University Talbot Campus Poole BH12 5BB Tel: 01202 9(62474) sallc...@bournemouth.ac.ukmailto:sallc...@bournemouth.ac.uk research.bournemouth.ac.uk/2014/07/inea-project-2 BU is a Disability Two Ticks Employer and has signed up to the Mindful Employer charter. Information about the accessibility of University buildings can be found on the BU DisabledGo webpages This email is intended only for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email, which must not be copied, distributed or disclosed to any other person. Any views or opinions presented are solely those of the author and do not necessarily represent those of Bournemouth University or its subsidiary companies. Nor can any contract be formed on behalf of the University or its subsidiary companies via email. [[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. The contents of this e-mail are confidential and may be ...{{dropped:14}} __ 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] Rcpp cpp11 and R CMD build
Edwin van Leeuwen edwinvanl at gmail.com writes: Thank you! I was missing the SystemRequirements. I guess it could be useful to add this to the example given here: http://gallery.rcpp.org/articles/simple-lambda-func-c++11/ No. If you actually read the Rcpp documentation--eg the Rcpp Attributes vignette- --then you'd know the difference between plugin use via sourceCpp() and proper package development. Which is what we recommend. We also ask that Rcpp-related questions be asked on the rcpp-devel list as they are mostly out-of-context here. Thanks, Dirk __ 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.