Displaying 20 results from an estimated 3000 matches similar to: "Subset a list"
2005 Jul 06
4
Tempfile error
Dear List:
I am encountering an error that I can't resolve. I'm looping through
rows of a dataframe to generate individual tex files using Sweave. At
random points along the way, I encounter the following error
Error in file() : cannot find unused tempfile name
At which point Sweave halts. There isn't a logical pattern that I can
identify in terms of why the program stops at
2006 Jun 06
2
Subset data in long format
I have data in a "long" format where each row is a student and each
student occupies multiple rows with multiple observations. I need to
subset these data based on a condition which I am having difficulty
defining.
The dataset I am working with is large, but here is a simple data
structure to illustrate the issue
tmp <- data.frame(id = 1:3, matrix(rnorm(30), ncol=10) )
long <-
2006 Apr 13
1
Subset rows over multiple columns
I have a data frame where I need to subset certain rows before I compute
the mean of another variable. However, the value that I need to subset
by is found in multiple columns. For example, in the data below the
value R0000160 is found in the first and second columns (itd_1 and
itd_45). These data are student responses to multiple choice test items
from a computer adaptive test. So, the variable
2005 Dec 05
4
Broken links on CRAN
Dear List:
When I click on the link to download a reference manual for a package on
cran, I get an error message that the file is damaged and could not be
repaired. I randomly chose various packages and the same error message
appears.
Are the links actually broken? I have also restarted my machine and
closed and re-opened acrobat.
I am using Windows XP, Acrobat Professional 6.0.0.5, and
2005 Jun 24
4
File System Size Limits?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Is there some limit on the size of a file system which can
be shared via samba? I'm trying to set up a file server
with a 100GB shared partition and it doesn't want to work.
I'm running Fedora Core 4, and Samba Version 3.0.14a-2.
The output from testparm looks like this:
[root@stitch samba]# testparm
Load smb config files from
2003 Apr 08
3
Multilevel Analyses in R
I am new to R and would like to get some practice analyzing multilevel data. I wonder if anyone can point me to a sample data set and command lines that I might replicate for a sample session. I would then compare my output with HLM output.
Any help is appreciated.
------
Harold C. Doran
Director of Research and Evaluation
New American Schools
675 N. Washington Street, Suite 220
Alexandria,
2010 Jul 28
2
read.delim()
I am reading in a very large file with names in it and R is truncating the number of rows it reads in. The separator in this file is a pipe '|' and so I use
dat <- read.delim('pathToMyFile', header= TRUE, sep='|')
It turns out that it is reading up to row 61145 and stopping and I think I see why, but am not sure of the best solution to this problem. I see the name of
2006 Aug 16
6
read.csv issue
I'm trying to read in some data from a .csv format and have come across
the following issue. Here is a simple example for replication
# A sample .csv format
schid,sch_name
331-802-7081,School One
464-551-7357,School Two
388-517-7627,School Three \& Four
388-517-4394,School Five
Note the third line includes the \ character. However, when I read the
data in I get
>
2013 Feb 03
5
The moving of VNC port from 580n to 590n
On my 'older' systems that include Centos 5.5 and Fedora 12, vncserver
is running on ports 580n where n is defined by userid in the
/etc/sysconfig/vncserver
I just spent a bit of time getting it working on my new Centos 6.3
server and found it listening on ports 590n.
When did the change occur?
And guess I should test out where it is on Fedora 17...
2007 Jan 23
3
Matrix operations in a list
I have matrices stored within a list like something as follows:
a <- list(matrix(rnorm(50), ncol=5), matrix(rnorm(50), ncol=5))
b <- list(matrix(rnorm(50), nrow=5), matrix(rnorm(50), nrow=5))
I don't recall how to perform matrix multiplication on each list element
such that the result is a new list
result <- list(a[[1]]%*%b[[1]], a[[2]]%*%b[[2]])
I think I'm close with
2010 Sep 20
5
Sorting and subsetting
Suppose I have a data frame, such as the one below:
tmp <- data.frame(index = gl(2,20), foo = rnorm(40))
And further assume it is sorted by index and then by the variable foo.
tmp <- tmp[order(tmp$index, tmp$foo) , ]
Now, I want to grab the first N rows of tmp for each index. In the end, what I want is the data frame 'result'
tmp1 <- subset(tmp, index == 1)
tmp2 <-
2004 Sep 08
8
isoMDS
Dear List:
I have a question regarding an MDS procedure that I am accustomed to
using. I have searched around the archives a bit and the help doc and
still need a little assistance. The package isoMDS is what I need to
perform the non-metric scaling, but I am working with similarity
matrices, not dissimilarities. The question may end up being resolved
simply.
Here is a bit of substantive
2010 Aug 17
3
R Send an Email
Just out of curiosity, has anyone ever written a function that sends an email to you when an R process has finished? For instance, I often work with very large data sets and certain tasks (e.g., merging records, lmer runs) can take a long time and I find myself constantly looking over to see if R is done.
But, it would just be neat if there was a way R could send me an email alerting me that a
2006 May 20
5
Can lmer() fit a multilevel model embedded in a regression?
I would like to fit a hierarchical regression model from Witte et al.
(1994; see reference below). It's a logistic regression of a health
outcome on quntities of food intake; the linear predictor has the form,
X*beta + W*gamma,
where X is a matrix of consumption of 82 foods (i.e., the rows of X
represent people in the study, the columns represent different foods,
and X_ij is the amount of
2005 Jul 08
2
Sweave resource leak: leftover temp files (PR#7999)
This is great. Thank you for your help, but let me make sure I fully
understand. Here is the looping file I use to subset the data frame,
create a tex file, and Sweave it. This results in N number of tex files
where N is equal to the number of rows in the data frame.
list <- unique(wide$stuid)
master = "master.tex"
for (i in list){
tmp1 <- subset(wide, stuid==i)
tmp2
2006 Jul 19
4
Wrap a loop inside a function
I need to wrap a loop inside a function and am having a small bit of
difficulty getting the results I need. Below is a replicable example.
# define functions
pcm <- function(theta,d,score){
exp(rowSums(outer(theta,d[1:score],'-')))/
apply(exp(apply(outer(theta,d, '-'), 1, cumsum)), 2, sum)
}
foo <- function(theta,items, score){
like.mat <-
2007 Jan 24
4
Replace missing values in lapply
I have some matrices stored as elements in a list that I am working
with. On example is provided below as TP[[18]]
> TP[[18]]
level2
level1 1 2 3 4
1 79 0 0 0
2 0 0 0 0
3 0 0 0 0
4 0 0 0 0
Now, using prop.table on this gives
> prop.table(TP[[18]],1)
level2
level1 1 2 3 4
1 1 0 0 0
2
3
2004 May 17
3
Fatal Error
Dear List:
When trying to open 1.9.0 this morning, I have the following error:
"Fatal Error: Unable to restore saved data in .Rdata"
I am using Windows 2000.
The program then quits. Do I need to reinstall?
Harold C. Doran
One Massachusetts Avenue, NW ยท Suite 700
Washington, DC 20001-1431
202.336.7075
[[alternative HTML version deleted]]
2005 Jan 20
3
Constructing Matrices
Dear List:
I am working to construct a matrix of a particular form. For the most
part, developing the matrix is simple and is built as follows:
vl.mat<-matrix(c(0,0,0,0,0,64,0,0,0,0,64,0,0,0,0,64),nc=4)
Now to expand this matrix to be block-diagonal, I do the following:
sample.size <- 100 # number of individual students
I<- diag(sample.size)
bd.mat<-kronecker(I,vl.mat)
This
2006 Sep 21
3
newie help needed
hi,
I am a system admin who has just set up R-2.3.1 in suse 9.1 (opteron)
for a previous windows user. Please forgive any obvious stupid questions :)
We are struggling with a number of things.
1. is there a gui interface ? How do we use it ? R --gui just gets us
to the command line.
2. how do we do unix commands like cd ?
3. can we define default directories - eg for data files ?
4.