Displaying 20 results from an estimated 80000 matches similar to: "Make the output (from a Loop function) a Vector"
2009 May 11
1
predict function the other way around
Dear List,
Consider the following example
x=c(1,2,3,4,5)
y=c(2,4,6,8,10)
linearmodel=lm(y~x)
To predict a y-value if you know the corresponding x value is very easy
with the command predict.
predict(linearmodel, newdata=(x=1.5))
The other way around, to predict an x-value with a corresponding
y-value, doesn't work unfortunately.
Is there another function that can do that, or do I need to
2009 Oct 13
2
time grid for "survfit" Survival function outputs
Dear All,
Maybe it is a silly question. But I wasn't able to find it from manual
or R site search.
I was wondering what is the corresponding time axis for survival
function outputs in "survfit". I think it is "survfit(.......)$time",
but not 100% sure.
If it is, is it possible we could make survival function outputs on
the pre-specified time grid with fixed increment and
2010 Feb 09
1
how to adjust the output
Hi R-users,
I have this code below and I understand the error message but do not know how to correct it. My question is how do I get rid of “with absolute error < 7.5e-06” attach to value of cdf so that I can carry out the calculation.
integrand <- function(z)
{ alp <- 2.0165
rho <- 0.868
# simplified expressions
a <- alp-0.5
c1 <-
2010 Feb 01
6
Import fixed-format ascii file with mixed record types
I need to import several ascii files in fixed format with two different record types. The data comes from European Labor Force Surveys, wich is a household survey. The first record type is for people over 16 years, and the second much sorter is for people aged 15 or less (this record has a filler with several blanks to get the same record length).
The files tipically have 160000 records, with 176
2007 Oct 21
6
exporting text output to pdf
Hello,
I am new to R and I am trying to figure out how to print text output from an operation like table() to a pdf file. Is there a simple command to do this, or do you need to work with connections at a rudimentary level?
Thanks you,
Jesse
[[alternative HTML version deleted]]
2009 Oct 08
5
histogram
Hi all,
I have a question about hist()
1)
> t1 <- hist(c(1,2,3,4,5))
> t1
$breaks
[1] 1 2 3 4 5
$counts
[1] 2 1 1 1
why is there 2 counts for 1? And should the counts be '1 1 1 1 1' ?
Is there any other function to count frequency of discrete data?
Thanks.
-k
[[alternative HTML version deleted]]
2009 Nov 22
3
Define return values of a function
I have created a function to do something:
i <- factor(sample(c("A", "B", "C", NA), 793, rep=T, prob=c(8, 7, 5,
1)))
k <- factor(sample(c("X", "Y", "Z", NA), 793, rep=T, prob=c(12, 7, 9,
1)))
mytable <- function(x){
xtb <- x
btx <- x
# do more with x, not relevant here
cat("The table has been created,
2009 Jul 07
1
how to get R to print only one column per line when outputting a matrix?
Hi,
I'm trying to make it easier for my survey evaluators to read the
results of my survey analysis. To that end, I'd like to suppress R's
habit of filling every line up to width columns. How do I do that?
For instance, using 'print()', R outputs something like:
[,1] [,2]
var2 "someshortname" "someothershortname"
r 0.3341755
2009 Jun 02
5
how to add value on the bar ploted by barplot()
how to add value on the bar ploted by barplot()?
and the axis label is too big, anyone know how to change their font , thanks
--
Xiaogang Yang
Sensorweb Research Laboratory
http://sensorweb.vancouver.wsu.edu/
Washington State University Vancouver
[[alternative HTML version deleted]]
2012 Feb 27
1
set heatmap.2 color ranges
Hi all,
I have a matrix with values between 0 and 1. I want to plot this matrix on a
heat map so anything >0.05 is blue, anything <=0.05 and >0.01 is yellow, and
anything else is grey. I am using the heatmap.2 function. I searched around
but did not find an efficient way to set colour ranges as I described. Could
anybody give some hints? Thank you in advance.
Wendy
--
View this
2009 Oct 14
2
Survival and nonparametric
Hi all,
Has any body the exprience to iclude a nonparametric component into the
survival analysis using R
package? *Can someone recommend *me * some ** references? *
Thanks a lot
Ashta
[[alternative HTML version deleted]]
2009 Oct 13
1
vis.gam() contour plots
Greetings,
I have what I hope is a simple question. I would like to change my
contour interval on the vis.gam( plot.type="contour") in the mgcv
package. Is this a situation where I need to modify the function or is
there a default value I can change?
Thanks
2009 Mar 21
1
bargraph.CI change se for sd
Hi there,
I am a beginner.
I would like to change the error bars in the bargraph.CI function from the
default (se) to (sd). The help file says
ci.fun= function(x) c(fun(x)-se(x), fun(x)+se(x))
Is there a simple way of telling the function what (x) precisely is - I
already define in in the of the bargraph.CI function and assume that is
should be able to use that information.
cheers,
Herwig
--
2009 Dec 13
3
Subtitle & conova post hoc
Hello,
I just have two questions I cannot figure out.
1) I would like to have a subtitle just below the main title
on my graphs and I cannot figure out how to do this, is it
possible? or is it only possible to have it at the bottom?
2) I need to run Conova post hoc test, do you know if it is
coded in R? any package I would find this test in?
Thank you very much for all the help
Have a nice
2011 Mar 21
5
Stucked with as.numeric function
Hi list,
I have problems with the as.numeric function. I have imported probabilities from external data, but they are classified as factors as str() shows. Therefore my goal is to convert the colum from factor to numeric level with keeping the decimals.
I have googled the problem for a while now and kept to several advices like
2009 Apr 27
3
Generalized linear models
I have to fit a generalized linear model in R, and I have never done this
before, so I'm in very much doubt.
I have a dataset (of 4036 observations)
claims sum grp
1 3852 34570293 1
2 1194 7776468 1
3 3916 26343305 1
4 1258 5502915 1
5 11594 711453346 1
...
there are 4 groups (grp).
The task
2009 Aug 21
2
gantt chart for dataset
hi,
Thanks for responding of gantt charts. but i have some problem regarding
with gantt charts. i.e.
Ymd.format <- "%Y/%m/%d"
Ymd <- function(x){ as.POSIXct(strptime(x, format=Ymd.format))}
gantt.info <- list(
labels =c("First task","Second task","Third task","Fourth task","Fifth
task"),
starts
2009 Oct 30
4
opacity under dispersion command under plotrix
Is there anyway to make the lines in the dispersion command come forward in
a plot and allow the fill in the dispersion parameter be transparent so all
of the lines I am using to note confidence intervals are shown?
-------------------------------------------
Joe King, M.A.
Ph.D. Student
University of Washington - Seattle
206-913-2912
jp@joepking.com
2010 Feb 10
3
What is the difference between typeof and storage.mode?
S Programming by Venables and Ripley (2000) says on page 8, "R objects
have another way to give information using the function
\tttext{typeof}, which often gives the same information as
\tttext{storage.mode}." It implies that there are some differences
between typeof and storage.mode.
However, according to ?typeof and ?storage.mode, it doesn't seem to be
so. Could somebody let me
2009 Oct 08
5
row selection
Hi all,
I have a matrix named x with N by C
I want to select every 5 th rrow from matrix x
I used the following code
n<- nrow(x)
> for(i in 1: n){
+ b <- a[i+5,]
>b
}
Error: subscript out of bounds
Can any body point out the problem?
[[alternative HTML version deleted]]