On Apr 30, 2014, at 9:32 PM, Waichler, Scott R wrote:
>> I would ask you to look at this loop-free approach and ask if this is not
>> equally valid?
>>
>> ans <- matrix(NA, ncol=2, nrow=2)
>> ind.not.na <- which(!is.na(a1))
>> ans[] <- condition1*a1[,,ind.not.na[1]]+ m2 # two matrices of equal
> I would ask you to look at this loop-free approach and ask if this is not
> equally valid?
>
> ans <- matrix(NA, ncol=2, nrow=2)
> ind.not.na <- which(!is.na(a1))
> ans[] <- condition1*a1[,,ind.not.na[1]]+ m2 # two matrices of equal
> dimensions, one logical.
> ans
> [,1] [,2]
> [1,] NA
On Apr 30, 2014, at 6:03 PM, Waichler, Scott R wrote:
> Here is a working example with no random parts. Thanks for your patience and
> if I'm still off the mark with my presentation I'll drop the matter.
>
> v <- c(NA, 1.5, NA, NA,
> NA, 1.1, 0.5, NA,
> NA, 1.3, 0.4, 0.9)
> a1 <-
Hi Evan,
If you just need one font, you may try the showtext package. Here is a
piece of code that you can test:
library(showtext)
# If you have this font installed
font.add("gara", "gara.ttf")
# Or you can install a similar one from Google Font
# font.add.google("EB Garamond", "gara")
# Try some
Hi,
I have this problem: K candidates apply for a job. There are R referees
available to review their resumes and provide feedback. Suppose that we would
like M referees to review each candidate (M < R). How would I assign
candidates to referees (or, conversely, referees to candidates)? Th
Hi
I use hmisc on a Windows 9-x64 machine and it causes an error:
running command 'cd "C:\Users\Renger\AppData\Local\Temp\Rtmp4IOgfH" & pdflatex
-interaction=scrollmode
"C:\Users\Renger\AppData\Local\Temp\Rtmp4IOgfH\file1b9482a7388"' had status 127
It also gives an API error 2.
The file is in
Hi all,
I just started to work with R a couple of weeks ago. Right now I would like
to regress an independent variable on a couple of explanatory variables. The
dependent variable is left censored in the sense that all negative values
and zero are set equal to one. This is done because I want to t
Dear R community,
I`d like to extract the parameters of a two-component mixture
distribution of noncentral student t distributions which was fitted to a
one-dimensional sample.
There are many packages for R that are capable of handling mixture
distributions in one way or another. Some in the
Try
?mapply
Description:
'mapply' is a multivariate version of 'sapply'. 'mapply' applies
'FUN' to the first elements of each ... argument, the second
elements, the third elements, and so on. Arguments are recycled
if necessary.
Rich
On Wed, Apr 30, 2014 at 9:03 PM, Waich
If you just want to limit the axis just insert as arguments
for the x axis
xlim = c(min, max),
and for the y
ylim = c(min,max) ,
where min and max correspond to the appropriate min and max for the x and y
axes
As for the panel.groups you mention medians where I was using means - if you
want me
Here is a working example with no random parts. Thanks for your patience and
if I'm still off the mark with my presentation I'll drop the matter.
v <- c(NA, 1.5, NA, NA,
NA, 1.1, 0.5, NA,
NA, 1.3, 0.4, 0.9)
a1 <- array(v, dim=c(2,2,3))
m1 <- matrix(c(NA, 1.5, 2.1, NA), ncol=2, by
On my system, the name of the Garamond font file is GARA.TTF.
Thus,
font_import(pattern = 'GARA')
will work, but
font_import(pattern="gara")
won't. Unfortunately, font_import seems to fail rather ungracefully when there
is no match to a pattern.
Jason
-Original Message-
From: r-h
On Apr 30, 2014, at 1:21 PM, Waichler, Scott R wrote:
> Ok, here is a toy example. I want to use a custom function that depends on
> more than one matrix/array as input, and I can't figure out how to do that
> with apply.
>
> v <- c(NA, 1.5, NA, NA,
> NA, 1.1, 0.5, NA,
> NA, 1.3,
I though that change in NEWS re: type.convert referenced the fact that numbers
which were longer than could be represented accurately within the constraints
of class numeric were now being read in as characters which would give you the
option to later convert with one of the bignum packages. You
I though that change in NEWS re: type.convert referenced the fact that numbers
which were longer than could be represented accurately within the constraints
of class numeric were now being read in as characters which would give you the
option to later convert with one of the bignum packages. You
Your command will generate 3 random values from gamma distributions,
the first will be from a gamma with shape a[1] and scale b[1], then
the 2nd will come from a gamma with shape a[2] and scale b[2] and the
3rd will have shape a[3] and scale b[3].
On Wed, Apr 30, 2014 at 3:00 PM, Stefano Sofia
wr
Dear list users,
could somebody explain to me which is the meaning of
rgamma(3, a, b)
when both a and b are two vectors of length 3?
I know that a is the shape and b is the scale, but I thought that they could
only be scalars.
Thank you for your help
Stefano
AV
On Apr 30, 2014, at 5:19 AM, Ramesh Das wrote:
> Dear all,
> I am in problem for installing the package "systemfit" in R-3.0.2 version.
> The error message is showing is as mentioned below. Now there is R-3.0.2
> version is there. so kindly anyone help me to solve this problem.
>
>
> Warning in
On 30/04/2014, 4:20 PM, Bos, Roger wrote:
Dear R-help,
I recently upgraded to R 3.1 patched and code that ran fine previously and now
giving a lot of errors because the data is coming in as strings instead of
numeric. I can fix my code to wrapping each item I want to use with
as.numeric(), b
Ok, here is a toy example. I want to use a custom function that depends on
more than one matrix/array as input, and I can't figure out how to do that with
apply.
v <- c(NA, 1.5, NA, NA,
NA, 1.1, 0.5, NA,
NA, 1.3, 0.4, 0.9)
a1 <- array(v, dim=c(2,2,3))
m1 <- matrix(c(NA, 1.5, 2.1,
Dear R-help,
I recently upgraded to R 3.1 patched and code that ran fine previously and now
giving a lot of errors because the data is coming in as strings instead of
numeric. I can fix my code to wrapping each item I want to use with
as.numeric(), but that seems very inefficient.
I looked at
Scott:
Your problem specification is rather vague: What do you mean by "use"?
In general, matrices are merely vectors with a dim attribute, so if
you can do what you want with them as vectors, then that will work for
them as matrices. For example:
> m1<- matrix(1:6, nr=3)
> m2 <- matrix(11:16, n
Hi Scott,
You could set up a three-dimensional array and then use apply on the
desired dimension (MARGIN in apply language).
HTH!
Many thanks,
Ranjan
On Wed, 30 Apr 2014 17:54:48 + "Waichler, Scott R"
wrote:
> Hi,
>
> I want to apply a custom function to all the elements of one matrix.
Hi,
I want to apply a custom function to all the elements of one matrix. The
function uses the value in the same i,j in a second matrix. How can I use
apply() or similar function to avoid nested loops in i and j?
Thanks,
Scott Waichler
Pacific Northwest National Laboratory
Richland, WA, USA
No picture attached, and you don't tell us what your trouble is, but your
model has -4 df, so it's incorrectly specified.
Take out these lines:
congressmanAttitudes ~~ congressmenPerceptConstiuentAttitudes
congressmenPerceptConstiuentAttitudes ~~ constiuentAttitudes
rollCallBehav ~~ congressmenPe
Hi,
I am working on a computer 64-bit OS, with 7.8 GB usable memory (RAM). The
allocated quota by my administrator is 12 GB.
Now, I use R's 'spdep' package to run an hedonic pricing model, using the
function errorsarlm and the following data:
1) A spatial weights matrix, converted from a
R Community -
I'm trying to build the model in the image below, but having troubles
correctly specifying the syntax:
library(lavaan)
library(semPlot)
lower <- matrix(c(1, 0, 0, 0, .475, 1, 0, 0, .738, .643, 1, 0, .608, .721,
.823, 1), 4, 4, byrow = TRUE)
colnames(lower) <- rownames(lower) <-
Hi Dark,
Sorry for the late response. Since you asked for a `data.table` solution as
well, here's one:
require(data.table)
dt <- as.data.table(rawData)
dt[, GRP := (0:(.N-1L))%/%25L, by=PersonID]
dt[, `:=`(var="codes", N = 1:.N), by=list(PersonID, GRP)]
dcast.data.table(dt, PersonID+GRP ~ var+N,
Dear all,
I am in problem for installing the package "systemfit" in R-3.0.2 version.
The error message is showing is as mentioned below. Now there is R-3.0.2
version is there. so kindly anyone help me to solve this problem.
Warning in install.packages :
package âsystemfit â is not available
Thanks lot again to all.
On Wed, Apr 30, 2014 at 2:32 PM, Rui Barradas wrote:
> Hello,
>
> The package is Zelig, not zelig, R is case sensitive.
> Try
>
> install.packages("Zelig", dependencies = TRUE)
>
>
> And can't you update your version of R? It's now R 3.1.0.
>
> Hope this helps,
>
> Rui
Hello everyone
I'm relatively new in R coding and I have a problem using the function
forrBuilder, from SPOT package.
> fitC <- forrBuilder(xe, ye, 1e-3, 1e2, "optim-L-BFGS-B" , 100,0,1,FALSE)
Error in x - matrix(rep(xmin, s), nrow = s, byrow = TRUE) :
non-conformable arrays
> traceback()
2: sp
Hi,
In this case, you may have to use:
dat1[sapply(dat1,function(x) any(grepl("\\bC\\b",x))) &
sapply(dat1,function(x) any(grepl("Au5",x)))]
o066_010 o066_022 o066_029 o066_034 o066_068 o066_072
1 sample sample sample sample sample sample
2
Hi James,
I guess the problem was because the columns you tried were factors.
Suppose `dat1` is your dataset (first).
library(stringr)
indx <- grep("sample", colnames(dat1))
toGrep <- read.table(text = str_trim(gsub("[sample.]", " ",
colnames(dat1)[indx])),
header = FALSE, stringsAsFactors
Merve,
I'm not 100 percent sure I understand everything that you want. But start
with the simulated likert scale data. The code that you have is not very
efficient and it has at least one typo. I do not know if columns or rows
represent the persons, so I'll set up as NROW and NCOL.
An efficient
How about:
testdf<-data.frame(names=c("min","max","sum"),a=1:3,b=4:6,c=c(5,7,9))
which(tolower(as.matrix(testdf)) == "sum",arr.ind=TRUE)
row col
[1,] 3 1
as.matrix coerces all elements to the lowest (character) mode, no?
Does it unclass anything like the example below?
Jim
On 04/30/2
On 30/04/2014, 8:02 AM, Frede Aakmann Tøgersen wrote:
Try
> foo <- data.frame(oid = 1:3, functions = c("mean", "sum", "sd"), type =
c(TRUE, FALSE, TRUE))
foo
oid functions type
1 1 mean TRUE
2 2 sum FALSE
3 3sd TRUE
foo == "sum"
oid functions type
Try
> foo <- data.frame(oid = 1:3, functions = c("mean", "sum", "sd"), type =
> c(TRUE, FALSE, TRUE))
> foo
oid functions type
1 1 mean TRUE
2 2 sum FALSE
3 3sd TRUE
> foo == "sum"
oid functions type
[1,] FALSE FALSE FALSE
[2,] FALSE TRUE FALSE
[
Hi,
On 04/28/2014 09:26 PM, Fong Chun Chan wrote:
./configure --prefix=/home/fong/usr/local
I set the my CAIRO_LIBS and CAIRO_CLAGS environment variables in my
~/.bashrc:
export CAIRO_LIBS=${HOME}/usr/local/lib
export CAIRO_CFLAGS=${HOME}/usr/local/include
maybe
export CAIRO_LIBS=-L${HOME
Hi,
It might be a primitive question but how to find the position of a string in a
data frame? Suppose I search the word "sum" (case insensitive) in a data frame
and it is in the 7th row, 3rd column, how to retrieve the indices 7, 3? I tried
to use grep with tapply but it doesn't work.
Many tha
Hello,
The package is Zelig, not zelig, R is case sensitive.
Try
install.packages("Zelig", dependencies = TRUE)
And can't you update your version of R? It's now R 3.1.0.
Hope this helps,
Rui Barradas
Em 29-04-2014 19:30, Ramesh Das escreveu:
Dear all,
I have a problem in installing the the
40 matches
Mail list logo