Displaying 20 results from an estimated 20000 matches similar to: "Simple loop"
2006 Jun 23
1
How to use mle or similar with integrate?
Hi
I have the following formula (I hope it is clear - if no, I can try to
do better the next time)
h(x, a, b) =
integral(0 to pi/2)
(
(
integral(D/sin(alpha) to Inf)
(
(
f(x, a, b)
)
dx
)
dalpha
)
and I want to do an mle with it.
I know how to use mle() and I also know about integrate(). My problem is
to give the parameter values a and b to the
2016 Apr 23
2
Data Frame Column Name Attribute
I am attempting to add a calculated column to a data frame. Basically,
adding a column called "newcol2" which are the stock closing prices from 1
day to the next.
The one little hang up is the name of the column. There seems to be an
additional data column name included in the attributes (dimnames?). So
when i run HEAD(DATAFRAMENAME) i get the column name = "Open". but
2005 Jun 28
1
Using data frames for EDA: Insert, Change name, delete columns? (Newcomer's question)
I am finding complex analyses easier than some elementary operations in
R. In particular I want to do some low level exploratory data analyses
with data in a data frame but cannot find commands to easily insert,
remove (delete), rename, and re-order (arbitrarily, not sort) columns.
I see that the micEcon package has an insertCol command, but that is for
matrices, not data frames. I have looked
2013 Feb 03
1
Fractional logit in GLM?
Hi,
Does anyone know of a function in R that can handle a fractional variable as the dependent variable? The catch is that the function has to be inclusive of 0 and 1, which betareg() does not.
It seems like GLM might be able to handle the fractional logit model, but I can't figure it out. How do you format GLM to do so?
Best,
Rachael
[[alternative HTML version deleted]]
2004 Aug 26
4
Column names of a data frame
I'm coming out with all the classic problems today ;-)
Can anyone tell me how to change the column names of an already existing
data frame? I've read the docs for ?data.frame and ?as.data.frame but
can't figure it out.
I want to make a new data.frame from some of the columns of an existing
data.frame, but when I do that, the new data.frame columns have the same
names as the old
2011 Mar 18
4
subset data frame with condition
Hello,
One more question.. I have the data.frame "pop":
xloc yloc gonad ind Ene W Area
1 23 20 516.74 1 0.02 20.21 1
2 23 20 1143.20 1 0.02 20.21 1
3 23 20 250.00 1 0.02 20.21 1
4 22 15 251.98 1 0.02 18.69 2
5 22 15 598.08 1 0.02 18.69 2
6 21 19 250.00 1 0.02 20.21 3
7 22 20 251.98 1
2011 Jan 13
3
Rotated, Right-Justified Labels for Shortened Tick Marks
Hello R-help,
I'm trying to make a fairly simple plot axis that goes something like
this:
plot(-10:10,-10:10, yaxt='n')
axis(side=2, las=1, hadj=1, tck=-.01, cex.axis=.6)
...but as you can see, the labels are not close enough to the y-axis
(where I want them... to save space for publication).
Can anybody help me figure out how to move these labels over the the
right a bit?
2011 May 13
2
Creating dataframes
I would like to create a certain number of dataframes out of one dataframe
where each of the dataframes
is related to a factor. This should be possible with a loop or a function,
as is very clumsy to do it manually
when there are quite a lot factors.
For example having a dataframe called "exmpl":
Site Value
1 12
1 15
1 18
1 21
1 12
1 13
2 15
2 12
2 58
2 62
2 22
2 65
2 29
3 21
3 55
2012 Apr 23
2
automating a script to read a file
Hi,
The following script (which I did not develop) is used to calculate and
plot a skewed normal curve. The script currently requires the user to
input six parameters, rather than reading these directly from a file.
I've been spinning wheels here, trying to figure out how to modify the
script to automate it. I have four data sets, each in excess of 300
records that I need to process.
My
2008 Oct 01
3
shifting ticks to left or right
Hey list,
Does anybody knows a command to centre the tick mark labels exactly
between the tick points (right shift)?
And then to exclude the last tick label on the right?
I know one can shift them using the 'hadj' option in par. But I am
wondering if there is a more convenient command!
Thanks a lot!!
Stefan
[[alternative HTML version deleted]]
2009 Jul 09
9
Population pyramids
Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I
2011 Mar 17
2
Counting
I have a matrix say:
23 1
12 12
0 0
0 1
0 1
0 2
23 2
I want to count of number of distinct rows and the number of disinct element
in the second column and put these counts in a column. SO at the end of the
day I should have:
c(1, 1, 1, 2, 2, 1, 1) for the distinct rows and c(1, 1, 1, 2, 2, 2, 2) for
the counts of how many times the elements in the second column exists. Any
help is
2013 Feb 03
1
Adding complex new columns to data frame depending on existing column
Hello
I have a data frame as below
V1 V2 V3 V4 V5 V6
chr1 18884 C CAAAA 2 0
chr1 135419 TATACA T 2 0
chr1 332045 T TTG 0 2
chr1 453838 T TAC 2 0
chr1 567652 T TG 1 0
chr1 602541 TTTA T 2 0
on which I want to perform complex rearrangement such that:
if V3 is a string >1 (i.e line 2) then I
2007 Nov 02
2
add histograms or distributions on regression line
hello, does anyone know how to add histograms or distributions
on regression like just like quantiles regression in RGraphGallery
below, a very
delicate codes. Thanks alot.
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=109
2012 Feb 11
3
Counting occurences of variables in a dataframe
Hi everybody,
I have a large dataframe similar to this one:
knames <-c('ab', 'aa', 'ac', 'ad', 'ab', 'ac', 'aa', 'ad','ae', 'af')
kdate <- as.Date( c('20111001', '20111102', '20101001', '20100315',
'20101201', '20110105', '20101001', '20110504',
2011 Apr 30
1
Sorting dataframe by number of occurrences of factor
Apologies for what's probably quite simple, but I'm having some problems with
sorting a data frame by the number of occurences of each level of a factor.
2008 Nov 20
2
Label justification (axis) (PR#13307)
Full_Name: Martin Karl-Friedrich Bader
Version: 2.8.0
OS: 10.5.3
Submission from: (NULL) (131.152.1.1)
Hi there,
when using las=1 on the y-axis the labels keep their centered justification,
e.g. if you plot a graph using the axis command: axis(side=2, at=c(0,50, 100,
125), lab=c("0","50","100", " "), las=1), then the 0 and the 50 are centered in
relation
2007 Feb 26
3
PLotting R graphics/symbols without user x-y scaling
Is it possible to add lines or other
user defined graphics
to a plot in R that does not depend on
the user scale for the plot?
For example I have a plot
plot(x,y)
and I want to add some graphic that is
scaled in inches or cm but I do not want the
graphic to change when the x-y scales are
changed - like a thermometer, scale bar or
other symbol -
How does one do this?
I want to build my own
2008 Oct 12
2
RFC: Kerning, postscript() and pdf()
Ei-ji Nakama has pointed out (from another Japanese user, I believe) that
postscript() and pdf() have not been handling kerning correctly, and this
is a request for opinions about how we should correct it.
Kerning is the adjustment of the spacing between letters from their
natural width, so that for example 'Yo' is usually typeset with the o
closer to the Y than 'Yl' would be.
2011 May 04
3
join tables in R
I'd to match-merge 2 tables in such a manner that I keep all the rows in table 1, but not the rows that are in both table 1 and 2.
Thank you for your help,
Alfredo
> master <- data.frame(ID=2001:2011)
> train <- data.frame(ID=2004:2006)
> valid <- ???
in this example table valid should have the following
> str(valid)
Year: int 2001 2002 2003 2007 2008 2009 2010 2011