similar to: `[.data.frame`(df3, , -2) and NA columns

Displaying 20 results from an estimated 10000 matches similar to: "`[.data.frame`(df3, , -2) and NA columns"

2006 Aug 13
2
How to order or sort a data.frame
I have a dataframe where I would like to order first by variable, year, and then within that variable by month. So far the only way that I have seen to do this is to order by year and then subset year and sort by month and then do an rbind to get things back together. Is this the right approach? Example: us.state <-rep("California", 23)
2001 Feb 27
2
Remove columns by name data[-c("subj","drug")]
Is there an easy way to remove data frame columns by name instead of by index? The following gives the idea remove<-c("subj","drug") data[-remove] I found a solution with a few evals and substitutes, similar to that used in reshapeLong, but there must be an easier way out. Dieter --------------------------------------- Dr. Dieter Menne Biomed Software 72074 T?bingen Tel
2011 Jun 06
1
Merge two columns of a data frame
I have the following data: prefix <- c("cheap", "budget") roots <- c("car insurance", "auto insurance") suffix <- c("quote", "quotes") prefix2 <- c("cheap", "budget") roots2 <- c("car insurance", "auto insurance") roots3 <- c("car insurance", "auto
2011 Aug 18
2
Best way/practice to create a new data frame from two given ones with last column computed from the two data frames?
Dear expeRts, What is the best approach to create a third data frame from two given ones, when the new/third data frame has last column computed from the last columns of the two given data frames? ## Okay, sounds complicated, so here is an example. Assume we have the two data frames: df1 <- data.frame(Year=rep(2001:2010, each=2), Group=c("Group 1","Group 2"), Value=1:20)
2006 Mar 25
7
Regexp subexpression
I can't get the PERL subexpression translated to R. Following, for example, B. Ripley's http://finzi.psych.upenn.edu/R/Rhelp02a/archive/58984.html I am using sub, but it looks like an ugly substitute. Assume I want to extract the first alpha part and the first numeric part, but only if they are in sequence. Do I really have to use the sub twice, first extracting the first variable, then
2009 Apr 06
6
Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
Hi there, I hope I can get advice regarding the calculation of leverage values or studentized residual values of a non-linear regression model. It seems like rstudent() does not work on a nls object. Many thanks in advance! Best regards, Xingli
2002 Jul 16
2
r-square for non-linear regression
We have extracted parameters from physiological measurements by fitting SSlogis-like curves with nlsList and nlme. We presented residuals plot in a paper, but a referee argues that these cannot be included (too technical), and r-square values should be given instead to compare the goodness of fit with those of other authors. I remember that 30 years ago in my stat 101, I learned that r-square is
2009 Sep 30
5
Condition to factor (easy to remember)
Dear List, creating factors in a given non-default orders is notoriously difficult to explain in a course. Students love the ifelse construct given below most, but I remember some comment from Martin M?chler (?) that ifelse should be banned from courses. Any better idea? Not necessarily short, easy to remember is important. Dieter data = c(1,7,10,50,70) levs =
2011 Aug 29
2
Saving a graph
I read somewhere that vector graphics such as eps or dpf are more favorable than alternatives (jpeg, bmp or png) for publication because vector graphics scale properly when enlarged. However, my problem is that the file generated from a graph of fixed size is too large (in the order of 10MB) because of many data points in multiple scatterplots. Any suggestions? Thanks, Gang [[alternative HTML
2010 Mar 20
5
Problem specifying Gamma distribution in lme4/glmer
Dear R and lme4 users- I am trying to fit a mixed-effects model, with the glmer function in lme4, to right-skewed, zero-inflated, non-normal data representing understory grass and forb biomass (continuous) as a function of tree density (indicated by leaf-area). Thus, I have tried to specify a Gamma distribution with a log-link function but consistently receive an error as follows: >
2004 Jun 11
3
Modifying Code in .rda based packages (e.g. lme4)
Dear List, assume I want to make a minor local change in a package that is supplied as .rda. For example, I want to get rid of the non-verbose-protected "Iteration" message in GLMM/lme4. Probably I have to load / change / save the package, but could someone help me to get the syntax right? Dieter Menne
2008 Jul 26
1
Can't get the correct order from melt.data.frame of reshape library.
Simple illustration, > df3 <- data.frame(id=c(3,2,1,4), age=c(40,50,60,50), dose1=c(1,2,1,2), dose2=c(2,1,2,1), dose4=c(3,3,3,3))> df3 id age dose1 dose2 dose41 3 40 1 2 32 2 50 2 1 33 1 60 1 2 34 4 50 2 1 3> melt.data.frame(df3, id.var=1:2, na.rm=T) id age variable value1 3 40 dose1 12 2 50 dose1 23 1
2005 Apr 06
2
par(mfcol=2, mfrow=3) equivalent for trellis
Dear friends of lattice, I know how to position trellis plots with print(...,split,more=T) or (...position). Sometimes I wish I had something like the old "par(mfcol=2, mfrow=3)" mechanism, where the next free viewport is automatically chosen. I tried fiddling with grid-viewports, but could not find an easy solution. Did I miss something? Dieter Menne
2005 Feb 02
3
publishing random effects from lme
Dear all, Suppose I have a linear mixed-effects model (from the package nlme) with nested random effects (see below); how would I present the results from the random effects part in a publication? Specifically, I?d like to know: (1) What is the total variance of the random effects at each level? (2) How can I test the significance of the variance components? (3) Is there something like an
2010 Jan 26
5
Strange tick in ggplot geom_area; and ordering, again
In the area plots below, I see 4 triangle ticks at both sides of the bar; I believe these are non-stacked values for p, but they are definitively confusing. In addition, I would like to get the order of the colors in the plot the same as in the legend, and not arranged alphabetically (the factor is ordered, don't touch my order). Hadley once mentioned an undocumented aestetics
2008 Dec 22
3
Convert ASCII string to Decimal in R (vice versa) was: Hex
Hi Dieter, Sorry my mistake. I wanted to convert them into Decimal (not Hexadecimal). Given this string, the desired answer follows: > ascii_str <- "ORQ>IK" 79 82 81 62 73 75 > ascii_str2 <- "FDC" 70 68 67 - Gundala Viswanath Jakarta - Indonesia On Mon, Dec 22, 2008 at 5:49 PM, Dieter Menne <dieter.menne at menne-biomed.de> wrote: > Gundala
2004 May 28
1
Pr(>|z|) in lme4
Dear List, I am struggling understanding S4 classes. For example, when GLMM summary(glmmML( whatever)) outputs the following line: Estimate Std. Error DF z value Pr(>|z|) (Intercept) 0.856 0.319 45 2.68 0.0073 How do I access the Pr column? Dieter
2011 Jul 28
2
not working yet: Re: lattice overlay
Hi Dieter and R community: I tried both of these three versions with ylim as suggested, none work: I am getting only single (pch = 16) not overlayed (pch =3) everytime. *vs 1* require(lattice) xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris, panel= function(x, y, subscripts) { panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10)) panel.lmline(x, y, lty=4, col =
2006 Jul 18
2
Sweave and multipage lattice
Dear R-Listeners, as the Sweave faq says: http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html creating several figures from one figure chunk does not work, and for standard graphics, a workaround is given. Now I have a multipage trellis plot with an a-priori unknown number of pages, and I don't see an elegant way of dividing it up into multiple pdf-files. I noted there is a "page"
2009 Jan 12
3
merge table rows (\multirow)
Hi: I need help merging rows. I am trying to merge the 'Month' column using \multirow. For example for the column 'Week' I want July to be merged into one row(weeks 27,28,29,30) and so on for the following weeks. Below, I am creating a PDF using Sweave, MikTex,R-2.8.1 and windows XP to show an example. \documentclass[11pt]{article} \usepackage{longtable,verbatim} \title{How to