Displaying 20 results from an estimated 1000 matches similar to: "calculation fraction/ratio"
2011 Oct 24
4
Lm function: Error in model.frame.default
Hello,
I am trying to get a linear model of y ~ log(x).
*> lm (y~log(x))*
However, I always get an error report:
/Error in model.frame.default(formula = y ~ log(x), drop.unused.levels =
TRUE) :
variable lengths differ (found for 'log(x)')/
*Here was my y:*
> y
[1] 0.4500000 0.0500000 0.5000000 0.4000000 0.0000000
0.5000000 0.4000000
[8] 0.0500000
2007 Dec 09
3
editor under MAC system
Dear R-user;
I recently switched from PC to MAC. Is there a compatible editor as
Win-editor with package RWinEdit for MAC?
Thanks
Yihsu Chen
[[alternative HTML version deleted]]
2009 Oct 07
1
Buglet in qbeta?
Hi,
I sometimes play around with extreme parameters for distributions and
found that qbeta is not always monotone as the following example shows.
I don't know whether this is serious enough to submit a bug report (as
this example is near to the limitations of floating point arithmetic).
Josef
> x <- qbeta((0:100)/100,0.01,5)
> x
[1] 0.000000e+00 1.253990e-201 1.589622e-171
2007 May 05
1
(no subject)
Dear Mailing-List,
I think this is a newbie question. However, i would like to integrate a
loop in the function below. So that the script calculates for each
variable within the dataframe df1 the connecting data in df2. Actually it
takes only the first row. I hope that's clear. My goal is to apply the
function for each data in df1. Many thanks in advance. An example is as
follows:
df1
2010 Apr 18
3
xtabs() of proportions, and naming a dimension (not a row)
Hi,
xtabs() creates a table of counts. I want a table of proportions -- that
is, I want to divide every vector (along a particular dimension) by its sum.
The tiny example below does that. The call to xtabs() creates a matrix "A"
with dimensions ("x1","x2","y"). I transform "A" using aperm() and aaply()
to get the matrix "B". The
2006 May 16
2
split the data.frame
Dear R folks:
I wonder anyone has a elegent way of doing what I need to do.
I have a data frame called with four columns: V1, V2, A1 and A2:
V1 V2 A1 A2
A B 1.2 2.0
A D 1.2 4.0
A C 2.4 2.2
What I need to do is to convert it into the following data frame with a new column x, where x is just the stacked up of A1 and A2 placed with respective V1 and V2 in the first two
2004 Mar 10
3
How to use MLE-class?
Hi there,
I had successfully use "MLE" function to solve my problem. Is there
anyone knows how to get related information? i.e., value of likelihood
function, information matrix, and etc. I know MLE-class can do it but I
can not find any information tells me how to do it.
Thanks a billions,
Yihsu
[[alternative HTML version deleted]]
2006 May 18
2
create a vector
Dear R users:
I have an elementary question: how to creat a vector of [A1, A2, A3...... A300]? I know c(1:300) would give 1, 2, 3, ...., 300 but not sure how to attch a A to each element.
Thank you
Yihsu Chen
The Johns Hopkins University
2006 May 19
1
Writing to a file with fixed precision
Dear R users;
A follow-up question regarding writing to a file with fixed precision:
Assuming for each column of x, I would like to have a different format, then I modify the code as:
x.fmt <- apply(x, 1, function(x) sprintf("%.14f %.10f %2.5f", x))
where three different formats are %.14f %.10f %2.5f.
The error message I got is "Error in sprintf(fmt, ...) : too few
2008 Dec 11
4
how to plot implicit functions
Dear R users --
I think this question was asked before but there was no reply to it.
I would appreciate any suggestion any of you might have. I am
interested in plotting several "implicit functions" (F(x,y,z)=0) on
the same fig. Is there anyone who has an example code of how to do
this?
Thank you
Yihsu
2007 Feb 22
2
write fixed format
Dear R users;
Is there a function in R that I can put "text" with proper alignments in
a fixed format. For instance, if I have three fields: A, B and C, where
both A and C are text with 3 characters and left alignment; B is a
numeric one with 2 decimals and 3 integer space digits. How can I put
the following row in a file? (note there is a space between a and 2, and
after b.)
2006 Apr 27
2
add city and point in the map
Dear Helpers:
I'm trying to use packages "maps" and "mapdata" (see blow) to display the research resutls on map (Mid-Atlantic region). In particular, I need to mark a number of points in the map by giving their latitude and longitude information. For instance, I would like to mark a point on (long, lat) =(75.56027, 39.09271). Also, I need to mark several cities that I
2007 Jul 09
1
ca.jo
Dear R users;
I'm using ca.jo for a VECM model. Is there a way that I can get sd/p-value
to see whether coefficients estimated are statistical significant? Thank
you
Yours,
Yihsu
[[alternative HTML version deleted]]
2006 May 18
1
How to write output in a specific formate with irregular space
Dear R users:
My question is how to write output in a specific formate with irregular
spacing?
Say that I have the following DF with three columns (A-C):
A B C
a10 100.0 212
The objective is to write an output file such that column A occupies
1-10 spaces aligned to the left, column B occupies 11-15 spaces aligned
to the right, and finally column C takes 16-25 spaces
2006 Jul 11
1
problem of fixed-formated output using sprintf
Dear R users:
I'm trying to generate a output file with fixed format using function "sprintf" in R. However, the execution time in R is very long even the toy data (smaller size df) seems to work fine. The syntax that I used is as follows:
df.fmt <- sprintf("%2s%2s%2.4f", df$v1, df$v2, df$v3)
write.table(df.fmt, output.name,...)
The actual dataset is a df with the
2013 Apr 17
2
On matrix calculation
Hello again,
Let say I have a matrix:
Mat <- matrix(1:12, 4, 3)
And a vector:
Vec <- 5:8
Now I want to do following:
Each element of row-i in 'Mat' will be divided by i-th element of Vec
Is there any direct way to doing that?
Thanks for your help
2011 Oct 31
3
Plot two matrices and keeping the record of row names
Dear all,
I have two data frames- x1 and y1 with same row names and column names(actually the names of the patients).
x1
a b c d e
a 1.0000000 0.4730679 0.6226994 0.6036036 0.6433333
b 0.4730679 1.0000000 0.6227273 0.6303855 0.5730858
c 0.6226994 0.6227273 1.0000000 0.7290503 0.6900585
d 0.6036036 0.6303855 0.7290503 1.0000000
2012 Dec 06
1
Can somebody help me with following data manipulation?
Dear all, let say I have following data:
dat <- structure(list(V1 = structure(c(1L, 4L, 5L, 3L, 3L, 5L, 6L, 6L,
4L, 3L, 5L, 6L, 5L, 5L, 4L, 4L, 6L, 2L, 3L, 4L, 3L, 3L, 2L, 5L,
3L, 6L, 3L, 3L, 6L, 3L, 6L, 1L, 6L, 5L, 2L, 2L), .Label = c("C",
"G", "I", "O", "R", "T"), class = "factor"), V2 = c(0L, 0L, 0L,
1L, 1L, 1L, 1L, 0L,
2008 Feb 12
4
summary statistics
below is my data frame. I would like to compute summary statistics
for mgl for each river mile (mean, median, mode). My apologies in
advance- I would like to get something like the SAS print out of PROC
Univariate. I have performed an ANOVA and a tukey LSD and I would
just like the summary statistics.
thanks
stephen
RM mgl
1 215 0.9285714
2 215 0.7352941
3 215 1.6455696
4 215
2006 Sep 02
2
Cuzick's test for trend
Hi All:
I was looking for, but could not locate in the packages, or in the R archive searches if there exists an R implementation of Cuzick's test of trend. The test is described as follows:
An extension of the Wilcoxon rank-sum test is developed to handle the situation in which a variable is measured for individuals in three or more (ordered) groups and a non-parametric test for trend