Displaying 20 results from an estimated 4000 matches similar to: "For loop by factor."
2010 Feb 28
1
"Types" of missingness
Dear R-List,
My questions concerns missing values. Specifically, is is possible to
use different "types" of missingness in a dataset and not a
one-size-fits-all NA?
For example, data may be missing because of an outright refusal by a
respondent to answer a question, or because she didn't know an answer,
or because the item simply did not apply. In later analysis it is
sometimes
2010 Apr 16
3
VERY SIMPLE QUESTION
Dear R users,
I am looking for more efficient way to compute the followings
--------------------------------------------------------------------------
a <- matrix(c(1,1,1,1,2,2,2,2),4,2)
b <- matrix(c(1,2,3,4),4,1)
Eventually, I want to get this matrix, `c`.
c <- matrix(c(1/1,1/2,1/3,1/4,2/1,2/2,2/3,2/4),4,2)
--------------------------------------------------------------------------
2010 Apr 16
3
GSL in C code for R
Dear fellow R users,
I am now investing time in learning how to use compiled C code to produces functions that can be used in R. I am just starting, and there is much that I need to learn, so I have a question that might be straight forward. I am learning how to use function in the C library GSL (gnu scientific library), to write C code, that I then plant to use in R. Is there any problem in
2008 Jun 24
1
transform a table into a matrix
Hi.
is there a way to transform a table that has numeric and categorical variables into a matrix?
thanks
Maria Mercedes Gavilanez
Department of Biological Sciences
107 Life Sciences Building
Louisiana State University
Baton Rouge, LA 70803
(225)578-4284
2010 Feb 22
3
gsub patterns from vector elements w/out loop?
Dear list,
I have two vectors:
x <- c("one","two")
y <- paste(rep(x,2),"blah")
I want to replace all occurrences of each element of x in y with
something else, so that y looks like this:
y
[1] "something else blah" "something else blah" "something else blah"
[4] "something else blah"
I can do this using a loop:
for (
2004 Feb 17
1
varimax rotation in R
Hi everyone-
I have used several methods to calculate principal components rotated using the varimax procedure. This is simple enough. But I would like to calculate the % of variance explained associated with each PC before and after rotation.
factanal returns the % of variance explained associated with each PC but I cannot seem to get it to change after rotation.
Many thanks for your
2008 Nov 03
2
Calculating R2 for a unit slope regression
Does anyone know of a literature reference, or a piece of code that can help me calculate the amount of variation explained (R2 value), in a regression constrained to have a slope of 1 and an intercept of 0?
Thanks!
Sebastian
J. Sebastián Tello
Department of Biological Sciences
285 Life Sciences Building
Louisiana State University
Baton Rouge, LA, 70803
(225) 578-4284 (office and lab.)
2023 Jun 25
1
depmixs4 standardError() issue
On Tue, 30 May 2023 17:43:31 +0000
Heather Lucas <hlucas2 at lsu.edu> wrote:
> Hello,
>
> I've been enjoying using the "Mixture and Hidden Markov Models in R"
> by Visser & Speekenbrink to learn how to apply these analyses to my
> own data using depmixS4.
>
> I currently have a fitted 4-state mixture model with three emissions
> variables and one
2004 Aug 24
5
MMX/mmxext optimisations
quite some speed improvement indeed.
attached the updated patch to apply to svn/trunk.
j
-------------- next part --------------
A non-text attachment was scrubbed...
Name: theora-mmx.patch.gz
Type: application/x-gzip
Size: 8648 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/theora-dev/attachments/20040824/5a5f2731/theora-mmx.patch-0001.bin
2011 Mar 09
2
SQLDF - Submitting Queries with R Objects as Columns
Fellow R programmers,
I'd like to submit SQLDF statements with R objects as column names.
For example, I want to assign "X" to "var1" (var1<-"X") and then refer to
"var1" in the SQLDF statement. SQLDF needs to understand that when I
reference "var1", it should look for "X" in the dataframe.
This is necessary because my SQLDF
2006 Mar 24
0
Random covariate in survreg (Survival)
Dear R Listers-
I am attempting to analyse the survival of seeds in cages
(exclosures) that differ in their permeability to rainforest mammals.
Because I did not observe the moment of seed disappearance, my data
is interval censored. This limits my options for analysis (as I
understand it) to survreg, in the survival package. Because I
repeated the experiment in 8 sites, I have a random
2003 Nov 14
1
plotmath problems with X11 fonts (Redhat 9)
We've only switched from redhat 7.3 to 9 several weeks ago, and
I found today, that the last three pages
of
demo(plotmath)
uses quite wrong plot symbols, e.g
sum(....) gives (+) {+ in circle} instead of the Sigma-like
summation --- but only in "text" not in title, i.e., probably a
font problem.
With postscript() {and hence dev.print() of x11()} all is fine.
Hence it must be an X
2011 Apr 13
1
Decimals in R/SQL
Hello,
When I am writing in sqldf or RSQLite I lose the decimals in my matrix.
The only way I can get decimals is by multiplying by 1.00000, etc. I
have tried manipulating the options, but it is only effective once I
multiply by 1.0000.
I appreciate any suggestions!
Thanks!
Example:
z <- sqldf ("select ST,
SUM(AGEP*PWGTP)*1.000000000/SUM(PWGTP)*1.00000000000000 as wgtage from
ss09
2006 Feb 21
2
rotated labels in barplot with beside=T and multiple groups
I have a data set that I display using barplot. I don't know what you
call it, but when I look at it, it looks like this:
> lsu
(0,0.1] (0.1,0.2] (0.2,0.3] (0.3,0.4] (0.4,0.5] (0.5,0.6]
A 0.052631579 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
B 0.000000000 0.000000000 0.001007049 0.003021148 0.000000000 0.000000000
E 0.200000000 0.000000000
1999 Mar 11
2
AFS on samba 2.0.2
>Ken, did you ever get afs support compiled into 2.0.2? I am in exactly
>the same boat as you are (were), where samba 1.9.18 was working great, but
>2.0.2 wouldn't compile with afs support. I too tried to copy the relavant
>parts of the makefile over, but ended up with the same errors as you did.
>Then I found your post to the samba list, and I'm hoping that you've
2010 Sep 01
5
[semi-OT] Using fortune() in an email signature
Hello, As you can see from my signature in this message, I use the R
fortune function to generate a fortune, which is then fed to the
signature program, which constructs a named pipe containing the
fortune-bearing sig, which is then included in mail messages. The
problem is that it's got extraneous junk in it and I can't figure out
how to get rid of it. This is the command that generates
2010 Jan 15
1
How to calculate the row wise means for grouped columns in matrix?
Hi all,
I want to calculate the row wise mean of groups of columns in a matrix M. All columns belonging to the same group have the same column name. My idea is to create a new vector V containing these column names, but after first removing the duplicates. Then I would calculate the means using for instance rowMean() and by comparing the column names of M with the vector V, getting the indices
2024 Sep 28
1
lattice xyplot with cumsum() function inside
This code gives unexpected result.
library(data.table)
library(lattice)
set.seed(123)
mydt <- data.table(date = seq.Date(as.IDate("2024-01-01"), by = 1,
length.out = 50), xgroup = "A", x = runif(50, 0, 1))
mydt <- rbindlist(list(mydt, data.table(date = mydt$date, xgroup = "B", x = runif(50, 0, 3))))
mydt[, `:=`(xcumsum = cumsum(x)), by = .(xgroup)]
mydt[,
2011 Feb 02
1
set digits in xtable by row
Hello R-listers,
I am using xtable to create some LaTeX tables for me to Sweave into my
document. I am now trying to set the number of digits that will be
reported in several _rows_ in my table.
The 'digits' option in xtable() sets the number of digits to display for
specified columns. Am I missing another obvious option to do the same
thing for rows? A quick RSiteSearch didn't turn
2004 May 14
3
type checking --- just a thought
hi: would it be useful to build into R an optional mechanism that
typechecks arguments? for example,
sum.across <- function ( inpmatrix : matrixtype( dim[1]>1, dim[2]>3
) ) : vector { }
# this would define a sum.across function that can take matrices
or data sets, but not vectors,
# and which indicates that it will return a vector.
xsum <- sum.across( 1:10