Displaying 20 results from an estimated 1000 matches similar to: "substituting level for NA in factor column"
2011 Jan 28
4
Months in alphabetical order rather than chronological order in graph
Greetings
Though I have months in chronological order in my data table, the data
were sampled every other month (i.e., February, April, June, August,
October, December), every time I try to plot them (on the x-axis) they are
plotted in alphabetical order. What am I missing?
Cheers
Kurt
***************************************************************
Kurt Lewis Helf, Ph.D.
Ecologist
EEO
2011 Jan 05
2
OT: Reducing pdf file size
Greetings
Does anyone have any suggestions for reducing pdf file size,
particularly pdfs containing photos, without sacrificing quality? Thanks
for any tips in advance.
Cheers
Kurt
***************************************************************
Kurt Lewis Helf, Ph.D.
Ecologist
EEO Counselor
National Park Service
Cumberland Piedmont Network
P.O. Box 8
Mammoth Cave, KY 42259
Ph: 270-758-2163
2010 Oct 22
2
Confusing error statement
Greetings
Using the following command I've been trying to subset a dataframe of
counts of an organism to compute the sizes of groups for use as a
predictor:
Hs.patches <- as.data.frame(with(Hs.long,
table(Cave,Year,Month,Region,Plot,)))
I am getting the following error message that I do not understand:
ERROR: argument is missing, with no default
Can anyone shed light on this
2010 Oct 18
3
remove numbers from string of characters
Greetings
I want to remove numbers from a string of characters that identify
sites so that I can merge two data frames. For example, a site in one
frame is called "001a Frozen Niagara Entrance" whereas the same site in
the other data frame is called "Frozen Niagara Entrance". It seems to me
the easiest thing to do would be to remove the numbers from the first data
2010 Sep 21
3
R-help Digest, Vol 91, Issue 21
All
Is there a script in R equivalent to the "if then" transforms one can
perform in Systat? For example, I want to create a "Treatment" column
coded either 1 or 2 for twelve field sites in a large data set. Ideally,
I'd be able to tell R to code sites a-f as 1 and sites g-l as 2.
Cheers
Kurt
***************************************************************
Kurt Lewis
2010 Nov 10
1
Inserting Missing Data
Greetings
I'm attempting to insert missing data on the smallest size class of
cave cricket instars into a data frame. The data involve censusing
photoplots (plots) of roosting cave crickets in which we discern in four
instars or size classes. I need to insert data on size class one into a
data frame that already has data on size classes two through four. The
data can be merged by their
2012 Feb 13
0
Singling out observations
Greetings
I am attempting to plot observations of a cave aquatic invertebrate
dating from 1901-2004. I can come up with a nice lattice plot of the eight
sites from which I have data easily enough. However, I'd like to be able
to highlight the 0 observations on the plots, i.e., attempts to find it at
the site were unsuccessful. I'd like to be able to highlight these
observations
2010 Oct 13
1
strip month and year from MM/DD/YYYY format
Greetings
I'm having difficulty witht the strptime function. I can't seem to
figure a way to strip month (name) and year and create separate columns
from a column with MM/DD/YYYY formatted dates. Can anyone help?
Cheers
Kurt
***************************************************************
Kurt Lewis Helf, Ph.D.
Ecologist
EEO Counselor
National Park Service
Cumberland Piedmont Network
2010 Jun 12
1
generating ordered, random decimal fractions
Greetings
How do I do this in R? Checking the Cran site produces a bewildering array
of packages that I can't seem to find to load. Surely the main program has
this function?
Cheers
Kurt
***************************************************************
Kurt Lewis Helf, Ph.D.
Invertebrate Ecologist
National Park Service
Cumberland Piedmont Network
P.O. Box 8
Mammoth Cave, KY 42259
Ph:
2018 May 03
4
adding overall constraint in optim()
Hi ?
This is giving me a headache. I?m trying to do a relatively simple optimization ? actually trying to approximate the output from the Excel Solver function but at roughly 1000x the speed. ?
The optimization parameters look like this. The only trouble is that I want to add a constraint that sum(wgt.vect)=1, and I can?t figure out how to do that in optim.
Mo.vect <-
2006 Sep 04
3
Subsetting vectors based on condition
Hello,
I have a question regarding subsetting of vectors. Here's an example of
what I'm trying to do:
vect.1 <- c(76,195, 290, 380)
vect.2 <- c(63, 95, 133, 170, 215, 253, 285, 299, 325, 375)
I would like to subset vect.2 so that it has the same length as vect.1,
and its numbers are the first corresponging higher value compared to
vect.1.
The output should be:
final.output =
2003 Nov 14
7
Vector indices and minus sign
Hi,
I got caught out by this behaviour in 1.8.0 and I wondered why this
happens:
I have a list of vectors and was using lapply and grep to remove
matched elements that occur in only a subset of the elements of the
list:
locs <- lapply(locs, function(x){x[- grep("^x", x)]})
The problem is that where the grep finds no matches and hence returns a
vector of length 0, all the
2018 May 03
2
adding overall constraint in optim()
Thanks Bert. But everyone on that forum wants to use finance tools rather than general optimization stuff! And I am not optimizing a traditional Markowitz mean-variance problem. Plus, smarter people here. :-)
> On May 3, 2018, at 3:01 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
>
> You can't -- at least as I read the docs for ?optim (but I'm pretty
> ignorant
2011 Feb 13
6
From numeric vector to string vector
Hi there, I have a numeric vector let say:
Vect <- c(12.234, 234.5675, 1.5)
Now I want a string vector like:
changedVec <- c("012.234", "234.568", "001.500")
Would be grateful if somebody help me how can I do that.
Thanks and regards,
[[alternative HTML version deleted]]
2008 Jun 09
1
Cross-validation in R
Folks; I am having a problem with the cv.glm and would appreciate someone
shedding some light here. It seems obvious but I cannot get it. I did read
the manual, but I could not get more insight. This is a database containing
3363 records and I am trying a cross-validation to understand the process.
When using the cv.glm, code below, I get mean of perr1 of 0.2336 and SD of
0.000139. When using a
2012 Dec 11
1
Rprof causing R to crash
I'm trying to use Rprof() to identify bottlenecks and speed up a particullary
slow section of code which reads in a portion of a tif file and compares
each of the values to values of predictors used for model fitting. I've
written up an example that anyone can run. Generally temp would be a
section of a tif read into a data.frame and used later for other processing.
The first portion
2012 Mar 17
3
rtriang using ifelse statement
Hi All,
I want to draw samples (n=4) from one of 2 triangular distributions for
each value in a matrix. I am using an ifelse statement to try to define
which distribution to draw from.
>From the output, I can see that the ifelse statement is choosing the correct
distribution, however, my n=4 simulations aren't occurring. Is there a way
to adjust the ifelse statement to fix this, or must
2018 May 04
0
adding overall constraint in optim()
On Thu, May 3, 2018 at 2:03 PM, Michael Ashton
<m.ashton at enduringinvestments.com> wrote:
> Thanks Bert. But everyone on that forum wants to use finance tools rather than general optimization stuff! And I am not optimizing a traditional Markowitz mean-variance problem. Plus, smarter people here. :-)
>
I'm very confused by these statements. Most of the "finance tools"
2009 Apr 16
2
error bars in matplot
Hi,
I was trying to get error bars in my matplot. I looked at an earlier thread, and the sample code that I made is:
#------------------
library(plotrix)
mat1 <- matrix(sample(1:30,10),nrow=5,ncol=2)
ses <- matrix(sample(1:3,10,replace=T),nrow=5,ncol=2)
vect <- seq(20,100,20)
rownames(mat1) <- rownames(ses) <- vect
colnames(mat1) <- colnames(ses) <- letters[1:2]
2018 May 06
1
adding overall constraint in optim()
Hi Michael,
A few comments
1. To add the constraint sum(wgt.vect=1) you would use the method of
Lagrange multipliers.
What this means is that in addition to the w_i (the components of the
weight variables) you would add an additional variable, call it lambda.
Then you would modify your optim.fun() function to add the term
lambda * (sum(wgt.vect - 1)
2. Are you sure that you have defined