Displaying 20 results from an estimated 10000 matches similar to: "Error with write.table"
2009 May 02
1
Trouble installing packages on Macintosh OS-X 10.5.6
I just upgraded my version of R from 2.8.1 to 2.9.0. After doing so, I now
have problems using the package installer to reinstall all my packages.
Some download and install without problems, but for others, I get the
spinning pinwheel and after even 10 minutes, nothing is downloaded. R stops
responding. At first, I had not deleted the old version of 2.8.1 before
installing 2.9.0. However, I
2010 Apr 05
2
find the "next non-NA" value within each row of a data-frame
#I wish to find the "next non-NA" value within each row of a data-frame.
#e.g. I have a data frame mydata. Rows 1, 2 & 3 have soem NA values.
mydata <- data.frame(matrix(seq(20*6), 20, 6))
mydata[1,3:5] <- NA
mydata[2,2:3] <- NA
mydata[2,5] <- NA
mydata[3,6] <- NA
mydata[1:3,]
#this loop accomplishes the task; I am tryign toi learn a "better" way
for(i
2010 Nov 01
3
Mean and individual growth curve trajectories
I'm trying to understand how to plot individual growth curve trajectories,
with the overall mean trajectory superimposed (preferably in a slightly
thicker line, maybe in black) over the individual trajectories. Using the
sleepstudy data in lme4, here is the code I have so far:
library(lme4)
library(lattice)
xyplot(Reaction ~ Days, data = sleepstudy, group = Subject, type = 'l')
2010 Jan 29
1
apply function with grouped columns
I have a data set of many rows and many columns in which both the rows and
the columns have associated grouping factors.
Is there a way to do what 'aggregate' does but in the other dimension?
The way I have been doing this is to use 'aggregate' on the data in the
usual way and then rotate the result and apply 'aggregate' again. This
works but is a little messy and I was
2009 Sep 18
1
Within-group correlation confidence intervals
I'm trying to obtain within-group correlations on a subset of variables. I
first selected my variables using the following command:
mydata$x<-mydata[c("iq","education","achievement")]
I'd like to look at correlations among those variables separately for men
and women. My gender variable in mydata is coded 1 (women) and 0 (men).
I have successfully used
2017 Dec 01
1
Bug is as.matrix.data.frame with nested data.frame
Converting a data.frame with a nested data.frame to a matrix fails:
x <- structure(list(a = data.frame(letters)),
class = "data.frame",
row.names = .set_row_names(26))
as.matrix(x)
#> Error in ncol(xj) : object 'xj' not found
The offending code is here, in the definition of as.matrix.data.frame
(source/base/all.R):
for (j in pseq) {
2010 Jan 03
6
Help with function "fitdistr" in "MASS"
Hi, R users:
I want to fit my data into a normal distribution by using the command
"fitdistr" in "MASS".
I changed my data class from "ts" to "numeric" by
>class(mydata)="numeric"
but after using "fitdistr", I got the result below
>fitdistr(mydata,"normal")
mean sd
NA NA
(NA) (NA)
the help doc of
2009 Aug 21
8
Selecting groups with R
I have a data set similar to the following:
Color Score
RED 10
RED 13
RED 12
WHITE 22
WHITE 27
WHITE 25
BLUE 18
BLUE 17
BLUE 16
and I am trying to to select just the values of Color that are equal to RED
or WHITE, excluding the BLUE.
I've tried the following:
myComp1<-subset(dataset, Color =="RED" | Color == "WHITE")
2009 Oct 14
1
using mapply to avoid loops
Hello, I would like to use mapply to avoid using a loop but for some reason, I can't seem to get it to work. I've included copies of my code below. The first set of code uses a loop (and it works fine), and the second set of code attempts to use mapply but I get a "subscript out of bounds" error. Any guidance would be greatly appreciated. Xj, Yj, and Wj are also lists, and s2,
2012 Jul 10
2
Changing x-axis values displayed on histogram
Is it possible to change the x-axis values in a histogram to reflect binned
values?
Here are my data:
histexample<-c(6,7,7,8,8,8,9,9,9,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,12,12,12,12,13,13,13,14,14,14,15,16)
hist(histexample)
Now, I'll bin pairs of adjacent values together (e.g., 5-6, 7-8, 9-10,
11-12, 13-14, 15-16) using the following
bins<-c(4.5,6.5,8.5,10.5,12.5,14.5,16.5)
2008 Jul 01
1
[.data.frame speedup
Below is a version of [.data.frame that is faster
for subscripting rows of large data frames; it avoids calling
duplicated(rows)
if there is no need to check for duplicate row names, when:
i is logical
attr(x, "dup.row.names") is not NULL (S+ compatibility)
i is numeric and negative
i is strictly increasing
"[.data.frame" <-
function (x, i, j,
2004 May 24
1
as.matrix.data.frame() in R 1.9.0 converts to character when it should (?) convert to numeric
Conversion of a data frame to a matrix using as.matrix() when a
column of the data frame is POSIXt and all other columns are numeric
has changed in R 1.9.0 from R 1.8.1. The new behavior issues a
warning message and converts to a character matrix. In R 1.8.1, such
an object was converted to a numeric matrix.
Here is an example.
#### R 1.9.0 ####
> foo <- data.frame(
2008 Jun 06
1
How to force two regression coefficients to be equal but opposite in sign?
Is there a way to set up a regression in R that forces two coefficients
to be equal but opposite in sign?
I'm trying to setup a model where a subject appears in a pair of
environments where a measurement X is made. There are a total of 5
environments, one of which is a baseline. But each observation is for
a subject in only two of them, and not all subjects will appear in
each
2009 Oct 29
3
Weird error: Error in xj[i] : invalid subscript type 'list'
I got the error. I haven't been able to get a stand along case so that
I can show it here. But could somebody give some clue on what could
cause this error? Since I never defined xj[i], I don't understand
where this error come from.
Error in xj[i] : invalid subscript type 'list'
2010 Jul 17
1
Help with Reshaping from Wide to Long
I am trying to reshape data that are in the wide format into the long format.
The design is a repeated-measures design, which combined 3 levels of shape
(circle, square, triangle) with 3 levels of color (Blue, Red, Green), for a
total of 9 variables. The wide data look like this (sorry I couldn't get
the columns to line up quite right:
Subject CircleBlue CircleRed CircleGreen SquareBlue
2003 Jun 18
1
suggestion for make.names
I would like to suggest a modification to the make.names() function.
The current implementation has two problems:
1. It doesn't check if a name matches an R keyword (like "function").
2. The uniqueness algorithm is not invariant to concatenation.
In other words,
make.names(c("a","a","a"),unique=T) !=
2003 Jun 18
1
suggestion for make.names
I would like to suggest a modification to the make.names() function.
The current implementation has two problems:
1. It doesn't check if a name matches an R keyword (like "function").
2. The uniqueness algorithm is not invariant to concatenation.
In other words,
make.names(c("a","a","a"),unique=T) !=
2009 Nov 04
4
unexpected results in comparison (x == y)
Dear readers of the list,
I have a problem a comparison of two data from a vector. The comparison
yields FALSE but should be TRUE. I have checked for mode(), length() and
attributes(). See the following code (R2.10.0):
-----------------------------------------------
# data vector of 66 double data
X =
2011 Jul 11
1
plot means ?
Hi,
I need this plot:
given: x,y - numerical vectors of length N
plot xi vs mean(yj such that |xj - xi|<epsilon)
(running mean?)
alternatively, discretize X as if for histogram plotting and plot mean y
over the center of the histogram group.
is there a simple way?
thanks!
--
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031
http://thereligionofpeace.com
2000 Nov 21
4
Session logging in Windows98?
I'd like to log all console I/O for an entire session while maintaining
normal console I/O. I'm working in Windows98, RGui, R1.1.1. The sink()
function is not the answer since it diverts output from the console. In the
RFAQ I see references to "...save the contents of the interaction buffer to
a file..." and in the R-Help Archive "...just save the console output...".
I