Displaying 20 results from an estimated 20000 matches similar to: "reduce printing accuracy"
2010 Oct 08
5
saving object function
Ok so if I have a function:
functest<-function(x){
a<-x+1
b<-x+2
c<-x+3
paste(a)
paste(b)
paste(c)
}
Now I know I can do cat(), or return() on one of them but if I was to run
the function with any number, how could I create objects to save so I could
do, I am wondering if I have more than one object within my function.
functest$a
2010 Nov 20
10
An empty grey diagram
Hi folks,
Win7 64bit
R 1.12.0
I run following command on R:-
> ToothGrowth
> attach(ToothGrowth)
> plot(dose,len)
> matrics=lm(len~dose)
> abline(metrics)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
Only a grey diagram is displayed without content
> plot(abline(metrics))
Error in int_abline(a = a, b = b, h = h, v
2010 Nov 02
5
Question about ggplot2
Dear All,
I am trying to graph a simple scatter plot where the x axis is year
and the y axis is a percentage (percentage of infant death). Instead
of plotting the raw data, I want to plot summary statistics such as
mean and median. Here is the problem: the value range of y is between
0 and 1, but since infant death is a rare event, the mean and median
is very low (something like 5%), which shows
2011 Mar 13
4
readMat - how to retrieve the variables
Hello
I have a matlab MAT file that contains one single variable: a. The
structure of a is as follows:
a.river1.flow (flow values)
a.river1.date_flow (date)
a.river1.precip (precipitation values)
a.river1.date_precip
a.river2.flow
a.river2.date_flow
a.river2.precip
a.river2.date_precip
I have used readMat to load the variable a in R, however I have no idea how
readMat translates a. I managed
2010 Jun 02
8
bind select data frames
Dear group,
Here is my environment:
> ls()
[1] "DailyPL100419" "DailyPL100420" "DailyPL100421" "dd" "i"
"l" "PLglobal" "Pos100416" "Pos100419" "Pos100420"
"Pos100421" "position"
[13] "result" "sel"
2011 Jun 21
5
omitting columns from a data frame
Dear R People:
I have a data frame, xm1, which has 12 rows and 4 columns.
If I put is xm1[,-4], I get all rows, and columns 1 - 3, which is as
it should be.
Now, is there a way to use the names of the columns to omit them, please?
Thanks so much in advance!
Sincerely,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
2013 Jan 27
1
decimal places in R2HTML
Dear R People:
I have an AOV model that I get confidence intervals from via
> confint(chick1.aov1)
2.5 % 97.5 %
trtA 1.472085 1.607915
trtB 1.512085 1.647915
trtC 1.328751 1.464582
>
I am using R2HTML to produce HTML output. However, the HTML code
itself just has rounded values, i.e., 1.5 and 1.6.
Has anyone run across this, please?
Any suggestions would be much appreciated.
2010 Jan 14
5
Better way than an ifelse statement?
Hello All,
I am trying to create a column of weights based off of factor levels
from another column. I am using the weights to calculate L scores.
Here is an example where the first column are scores, the second is my
"factor" and the third I want to be a column of weights. I can do
what I want with an ifelse statement (see below), but I am wondering
if anyone knows of a cleaner way
2010 Oct 07
6
Deleting observations - can't see the data after that
Hello all,
I am loading a data frame, fitting a model, getting diagnostic plots and they are flagging a couple of observations as problematic. Fair enough, and I want re-fit without them.
After I delete an offending row (identified by one of the diagnostic plots), something like
data = data[-3,];
then R will no longer print the contents of the data frame; it tells me it is a data frame
2012 Mar 13
2
sort list
Hello can anyone help please?
i read two words "cell1", "cell2" into a list. I want to turn this list
into a factor.
> cell_data <-list(c('cell1','cell2'))
> cell_data
[[1]]
[1] "cell1" "cell2"
> factor_list <- factor(cell_data)
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called
2011 Jul 16
4
Z-test
Hi,
please could you recommend a R package that computes a 2 sample z-test ?
thanks,
Bogdan
[[alternative HTML version deleted]]
2010 Jul 16
4
how to comment off sections
Hello,
Is there an way to easy comment of sections of code? I was thinking
something along the lines of
\dontrun{
codeline 1
....
codeline k
}
but that could be used in regular script files. When I am still
working on a script, I often want to being using what is done, but I
would like the parts I am still working on not to be run when I use
source() on the file. I can set everything off
2014 Aug 07
2
How to (appropropriately) use require in a package?
Dear All,
What is the preferred way for Package A, to initialize a cluster, and load
Package B on all nodes?
I am writing a package that parallelizes some functions through the use of
a cluster if useRs are on a Windows machine (using parLapply and family).
I also make use of another package in some of my code, so it is necessary
to load the required packages on each slave once the cluster is
2010 Aug 04
2
by group testing
Hello,
I have a data set which is similar to the following data
mice <- rep(letters[1:4],10)
outcome <- sample(c(0,1),length(mice),replace=T)
group <- c(rep("A",length(mice)/2),rep("B",length(mice)/2))
my.data <- data.frame(mice,outcome,group)
my.sort.data <- my.data[order(my.data[,1]),]
I would like to test wether there is a different between group A and B
2010 Jul 22
5
choosing a random sample by precentage
hi all
i have found the follwoing way to choose a random sample by sample size (200):
ten_per_T2000 <- F_T2000_All[sample(nrow(F_T2000_All), 200), ]
but i wondered if there is a way to choose a sample size by
precentage (10% etc..)
thx
ethan
2011 Aug 23
3
GLM question
Hi All,
I am trying to fit my data with glm model, my data is a matrix of size n*100. So, I have n rows and 100 columns and my vector y is of size n which contains the labels (0 or 1)
My question is:
instead of manually typing the model as
glm.fit = glm(y~ x[,1]+x[,2]+...+x[,100], family=binomial())
I have a for loop as follows that concatenates the x variables as follows:
final_str=NULL
for
2010 Nov 06
4
calculate probability
Dear All
I have 2 value assume 2.4 and 2.9 and mean = 2 variance = with n = 10
I want to find probability = 2.4 and 2.9.
How I can do this.
Many Thanks.
Jumlong
--
Jumlong Vongprasert Assist, Prof.
Institute of Research and Development
Ubon Ratchathani Rajabhat University
Ubon Ratchathani
THAILAND
34000
[[alternative HTML version deleted]]
2010 Nov 09
5
Question regarding to replace <NA>
Dear r-users,
Basically, I have a data as follows,
> data
S s1 s2 s3 s4 s5 prob obs num.strata
1 NNNNN N N N N N 0.0000108 32 <NA>
2 NNNNY N N N N Y 0.0005292 16 <NA>
3 NNNYN N N N Y N 0.0005292 24 <NA>
4 NNNYY N N N Y Y 0.0259308 8 1
....
I want to replace <NA> by 0, when I tried the following
2010 Mar 12
2
Return one value, print another
Dear R users,
I am stuck trying to figure out how to make a function return one
value and print another.? Here is an example function:
##################
eg <- function(x, digits=4) {
xbar <- mean(x)
sdx <- sd(x)
value <- list(xbar, sdx)
names(value) <- c("Mean of X", "SD of X")
return(value)}
##################
My current "solution" has been to
2010 Sep 17
1
how to work with Year-Month dates
Hi all,
Is there a built in or easier way to work with dates that are *just* Year-Month?
Right now I paste() on a day as a work around, but it ultimately needs to be
in Year-Month form, so then I use format() to get rid of the day.
x <- c("2006-December", "2006-July")
x <- paste(x, "-01", sep='')
x <- as.Date(x, "%Y-%B-%d")
x <- sort(x)