similar to: Data frame with 0 rows.

Displaying 20 results from an estimated 20000 matches similar to: "Data frame with 0 rows."

2008 May 16
1
Making slope coefficients ``relative to 0''.
I am interested in whether the slopes in a linear model are different from 0. I.e. I would like to obtain the slope estimates, and their standard errors, ``relative to 0'' for each group, rather than relative to some baseline. Explicitly I would like to write/represent the model as y = a_i + b_i*x + E i = 1, ..., K, where x is a continuous variate and i indexes groups (levels of a
2006 Mar 23
3
Intercepts in linear models.
A colleague asked me if there is a way to specify with a ***variable*** (say ``cflag'') whether there is an intercept in a linear model. She had in mind something like lm(y ~ x - cflag) where cflag could be 0 or 1; if it's 0 an intercept should be fitted, if it's 1 then no intercept. This doesn't work ``of course''. The cflag just gets treated as another predictor
2007 Oct 03
3
Factor levels.
I have factors with levels ``Unit", "Achieved", and "Scholarship"; I wish to replace these with "U", "A", and "S". So I do fff <- factor(fff,labels=c("U","A","S")) This works as long as all of the levels are actually present in the factor. But if ``Scholarship'' is absent (as if often is) then
2012 Oct 05
1
Format of numbers in plotmath expressions.
I want to do something like: TH <- sprintf("%1.1f",c(0.3,0.5,0.7,0.9,1)) plot(1:10) legend("bottomright",pch=1:5,legend=parse(text=paste("theta ==",TH))) Notice that the final "1" comes out in the legend as just plain "1" and NOT as "1.0" although TH is [1] "0.3" "0.5" "0.7" "0.9"
2005 Jun 06
1
Missing values in argument of .Fortran.
I wish to pass a vector ``y'', some of whose entries are NAs to a fortran subroutine which I am dynamically loading and calling by means of .Fortran(). The subroutine runs through the vector entry by entry; obviously I want to have it do one thing if y[i] is present and a different thing if it is missing. The way I am thinking of proceeding is along the xlines of: ymiss <- is.na(y)
2012 Oct 30
5
Swap rows and columns in a matrix
Dear R users, I want a help to write an algorithm for swapping rows and columns in a matrix thanks in advance [[alternative HTML version deleted]]
2012 May 19
1
Names of Greek letters stored as character strings; plotmath.
I had such good luck with my previous question to r-help, (a few minutes ago) that I thought I would try again with the following query: > Suppose I have > > xNm <- "gamma" > > I would like to be able to do > > plot(1:10,xlab = <something involving xNm">) > > and get the x axis label to be the Greek letter gamma > (rather than the
2008 Oct 24
4
Mail server problem?
I keep getting repeated copies of ``R-help post acknowledgements'' in respect of a couple of postings that I made to the list this morning (my time). I only posted each posting *once*. I hope that others are not getting repeated copies of my postings .... I mean I *know* my postings are so wonderful they merit re-reading, but one does not need another copy in order to re-read! :-)
2008 Jun 06
3
Existence of formal arguments.
I just discovered what seems to me to be a slight funny in respect of formal argument names. If I define a function foo <- function(a,b){ ... whatever ...} then ``inside'' foo() the exists() function will return TRUE from ``exists("a") whether an object named ``a'' exists or not. But get("a") will yield an error ``object "a" not found''
2009 Sep 27
2
Determining name of calling function.
I have vague recollections of seeing this question discussed on r-help previously, but I can't find the relevant postings. I want to determine (from within a given function) the name of the function calling that given function. E.g. if I have a function foo() which calls a function bar(), and also a function clyde() which calls bar(), I want to have, in the code of bar(), an instruction
2008 Aug 14
2
Department of Redundancy Department.
I just noticed a certain ``usage'' in a recent posting, and couldn't restrain my self from commenting. The usage was of the form ``if(X==TRUE)'' where X was a logical variable. This sort of thing is brought to you by your Department of Redundancy Department. The ``==TRUE'' bit is irrelevant, incompetent, and immaterial, as Perry Mason used to say. The value of
2010 Feb 28
6
A slight trap in read.table/read.csv.
I had occasion recently to read in a one-line *.csv file that looked like: "CandidateName","NSN","Ethnicity","dob","gender" "Smith, Mary Jane",111222333,"E","2/25/1989","F" That "F" (for female) in the last field got transformed to FALSE. Apparently read.csv (and hence read.table) are inferring
2008 Sep 10
2
RSiteSearch for words ``as one entity''.
I tried to search for a string of words ``as one entity'' following the example in the help file: > RSiteSearch("{logistic regression}") and got the error message: 2008-09-11 08:55:41.356 open[823] No such file: /Users/rturner/http:/ search.r-project.org/cgi-bin/namazu.cgi?query={logistic+regression}
2008 Jul 01
1
Messge ``no visible binding''.
I have written a function make.fun(), which I keep in my personal ``miscellaneous'' package. It searches the current working directory for files named ``*.R'' and sources them if their modification date is later than the date stored in ``.Last.make.date''. (The variable .Last.make.date then gets updated.) The function checks whether .Last.make.date exists before
2009 Jul 28
2
A hiccup when using anova on gam() fits.
I stumbled across a mild glitch when trying to compare the result of gam() fitting with the result of lm() fitting. The following code demonstrates the problem: library(gam) x <- rep(1:10,10) set.seed(42) y <- rnorm(100) fit1 <- lm(y~x) fit2 <- gam(y~lo(x)) fit3 <- lm(y~factor(x)) print(anova(fit1,fit2)) # No worries. print(anova(fit1,fit3)) # Likewise. print(anova(fit2,fit3)) #
2007 Nov 05
3
Hmisc for Mac OSX.
I'm not sure if this is the right target to which to direct this post, but I couldn't think of anything more appropriate. I just downloaded the Hmisc package to the Imac that I use. When I attempted to load it I got an error to the effect that it could not load the library: /Library/Frameworks/R.framework/Versions/2.5/Resources/lib/ libgfortran.2.dylib Note the ``2.5'' in
2009 Nov 24
1
The "lib" argument in install.packages().
I was flummoxed for a long time by errors generated when I did something like install.packages(foo,lib="Rlib") where ``Rlib'' is my personalized directory of R packages, which lives in my home directory (from which I started R before issuing the foregoing install.packages() call. Recently someone (I forget who, but thanks very much to whomever it was) pointed out that I
2023 Feb 13
2
Removing variables from data frame with a wile card
x[?V2?] would retain columns of x headed by V2. What I need is the opposite??I need a data grime with those columns excluded. Steven from iPhone > On Feb 13, 2023, at 9:33 AM, Rolf Turner <r.turner at auckland.ac.nz> wrote: > > ? >> On Sun, 12 Feb 2023 14:57:36 -0800 >> Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: >> >> x["V2"]
2008 Sep 23
1
Error: subscript out of bounds.
Consider: > x <- array(1:12,dim=12) > x[13] [1] NA] > m <- array(1:12,dim=c(3,4)) > m[3,5] Error: subscript out of bounds Can anyone tell me it there is a Good Reason for the difference in behaviour between 1 dimensional and higher dimensional arrays? In a bit of code that I was working on I expected the NA behaviour and didn't get it of course. Then I had to
2008 Apr 03
1
Extractor function for standard deviation.
I have from time to time seen inquiries on r-help in respect of how to obtain the estimated standard deviation from the output of fitting a linear model. And have had occasion to want to do this myself. The way I currently do it is something like summary(fit)$sigma (where fit is returned by lm()). It strikes me that it might be a good idea to have an extractor function, analogous with coef()