similar to: variable name to hist within apply?

Displaying 20 results from an estimated 4000 matches similar to: "variable name to hist within apply?"

2000 Feb 09
1
error during no-segfault.R
Hello, I am trying to install R0.99 on my PC running Solairis 7. Here is some text from my shell when I ran 'make check': running `primitive-funs.R' comparing `primitive-funs.Rout' to `./primitive-funs.Rout.save' ... OK running `mode-methods.R' comparing `mode-methods.Rout' to `./mode-methods.Rout.save' ... OK running `simple-true.R' comparing
2005 Nov 09
2
help with legacy R code
Hi there, Could somebody help me disect this legacy R script I inherited at work, I have two questions: 1. I've tried to upgrade our R version from 1.6.2 (yeah, I know), to R 2.0, but some of the lines in this script are not compatible with R 2.0, could someone help me figure out where the problem is? 2. the jpeg generated (attached) seems to be off on some of the data, is there a better way
2010 Jul 29
1
Using 'dimname names' in aperm() and apply()
I think that the "dimname names" of tables and arrays could make aperm() and apply() (and probably some other functions) easier to use. (dimname names are, for example, created by table() ) The use would be something like: -- x <-table( from=sample(3,100,rep=T), to=sample(5,100,rep=T)) trans <- x / apply(x,"from",sum) y <- aperm( trans,
2010 Mar 27
5
producing a QQ plot.
Hello everyone I'm a beginner in Stats and R, I'm using R 2.10.1. I need to create a multivariate qq plot, there is 8 variable group with each has 55 number of input. An example of what I did so far, just to get my point out: > data=read.csv(file.choose(),header=T) > data country village group av_expen P2ary_ed no_fisher 1 Cook Islands Aitutaki D
2007 May 09
1
predict.tree
I have a classification tree model similar to the following (slightly simplified here): > treemod<-tree(y~x) where y is a factor and x is a matrix of numeric predictors. They have dimensions: > length(y) [1] 1163 > dim(x) [1] 1163 75 I?ve evaluated the tree model and am happy with the fit. I also have a matrix of cases that I want to use the tree model to classify. Call it
2009 Sep 01
1
understanding the output from gls
I'd like to compare two models which were fitted using gls, however I'm having trouble interpreting the results of gls. If any of you could offer me some advice, I'd greatly appreciate it. Short explanation of models: These two models have the same fixed-effects structure (two independent, linear effects), and differ only in that the second model includes a corExp structure for
2008 Apr 21
1
Labelling a secondary axis in R
Hello, How can I label a secondary axis in R? At the moment it's labelled as c(-100,200). Obviously I would like it to be more sensible. Here is the code I am using newx = -100+37.5*((1:9)-1) axis(4,at=newx,labels=(newx+100)/3750) Thanks, Rob -- View this message in context: http://www.nabble.com/Labelling-a-secondary-axis-in-R-tp16807708p16807708.html Sent from the R help mailing list
2010 Aug 19
2
Can't read/write to _nonfi
Good afternoon, Hope you all have a wonderful day. I am glad to be here. Hope you could help me with the following errors that i have been trying to figure it all out since last week. I am using Splus from Insightful, and as i read, R and Splus are very similar. So hope you could help me. I have been continously received these error messages after i ran my small program for couple of
2006 Sep 28
2
safe prediction from lm
I am fitting a regression model with a bs term and then making predictions based on the model. According to some info on the internet at http://www.stat.auckland.ac.nz/~yee/smartpred/DummiesGuide.txt there are some problems with using predict.lm when you have a model with terms such as bs,ns,or poly. However when I used one of the examples they said would illustrate the problems I get virtually
2004 Oct 25
1
Ref: Variable scope or function behaviour or array reassign
Dear R- helpers Following a draft structure of the R script for which I am facing problem Step 1 x <- of type array with original values y <- of type array with original values Step 2 for (ctr in 1:10) { # my problem here the both x and y still show the original values from step 1 # in spite of making changes to the old values of the arrays x and y in the function function
2007 May 07
3
like apply(x,1,sum), but using multiplication?
Hi, I need to multiply all columns in a matrix so something like apply(x,2,sum), but using multiplication should do. I have tried apply(x,2,"*") I know this must be trivial, but I get: Error in FUN(newX[, i], ...) : invalid unary operator The help for apply states that unary operators must be quoted. I tried single quotes too, with the same results. Thanks, -Jose -- Jose
2013 Mar 23
1
Error with custom function in apply: ”Error in FUN(newX[, i], ...) : unused argument(s) (newX[, i])”
Hi everyone, I wonder if I can get your help using a custom function in apply. Imagine the following dataframe called "data": LowLim HighLim A1 A2 A3 A4 4 6 3 4 5 6 4 6 4 5 5 6 2 3 1 4 2 3 2 3 NA NA NA NA We have created a custom function (see below) that takes the values in a given row between columns A1 to A4 to see if they are outside the limits in the same
2007 Jan 19
1
hiccup in apply?
Hello, I don't understand the behavior of apply() on the data frame below. test <- structure(list(Date = structure(c(13361, 13361, 13361, 13361, 13361, 13361, 13361, 13361, 13362, 13362, 13362, 13362, 13362, 13362, 13362, 13362, 13363, 13363, 13363, 13363, 13363, 13363, 13363, 13363, 13364, 13364, 13364, 13364, 13364, 13364, 13364, 13364, 13365, 13365, 13365, 13365, 13365, 13365, 13365,
2009 Sep 22
1
odd (erroneous?) results from gls
A couple weeks ago I posted a message on this topic to r-help, the response was that this seemed like odd behavior, and that I ought to post it to one of the developer lists. I posted to r-sig-mixed-models, but didn't get any response. So, with good intentions, I decided to try posting once more, but to this more general list. The goal is (1) FYI, to make you aware of this issue, in case it
2010 Aug 13
2
Unable to retrieve residual sum of squares from nls output
Colleagues, I am using "nls" successfully (2.11.1, OS X) but I am having difficulties retrieving part of the output - residual sum of squares. I have assigned the output to FIT: > > FIT > Nonlinear regression model > model: NEWY ~ PMESOR + PAMPLITUDE * cos(2 * pi * (NEWX - POFFSET)/PERIOD) > data: parent.frame() > PMESOR PAMPLITUDE POFFSET >
2002 Jan 12
2
Bug in predict(newdata=x) with poly() (PR#1258)
Bug in predict.lm & poly The predict function doesn't work when used with poly and newdata. For example, I'd expect the following code to work, and plot a fitted cubic to the nearly straight line: x <- 1:10 y <- x + rnorm(10)/100 plot(x,y) fit <- lm(y ~ poly(x,3)) newx <- seq(1,10,len=100) lines(newx,predict(fit,newdata=data.frame(x=newx))) However, the plotted
2007 Feb 08
1
smartpred depends on fitted() in flexmix?
Hi, I was going through the examples in smartpred. It seems there's an unstated dependency on the fitted() function in package flexmix. n = 20 set.seed(86) x = sort(runif(n)) y = sort(runif(n)) library(splines) fit = lm(y ~ ns(x, df=5)) plot(x, y) lines(x, fitted(fit)) # won't work w/o prior loading of the flexmix package. newx = seq(0, 1, len=n) points(newx, predict(fit,
2008 Mar 17
3
Creating plots for all variables in a data frame and printing them with the variable name in the main title
Dear all, I'm just trying to create plots for all variables in a dataframe (named "x") using the following: png() apply(x,2,hist) Just as intended, it produces one plot for each variable. Unfortunately, the main title of each graph is "Histogram of newX[,i]" instead of "Histogram of name of variable". This makes it impossible to assign the graphs to the
2008 Feb 05
2
How to generate table output of t-test
Hi, Given test <- matrix(c(1, 1,2,2), 2,2) t <- apply(test, 1, t.test) How can I obtain a table of p-values, confidence interval etc, instead of [[1]] One Sample t-test data: newX[, i] t = 3, df = 1, p-value = 0.2048 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -4.853102 7.853102 sample estimates: mean of x 1.5 [[2]]
2012 Sep 08
3
Apply a function to columns of a matrix
Dear All,   as a follow up to my previous e-mail (I think I am getting closer...):   I am trying to apply the trapezoidal functions to a matric column by column. I have the following code:   a <-matrix(c(1:100),ncol=10) b <-matrix(c(2,4,6,8,10,12,14,16,18,20))   apply(a,2,function(b,a) sum(diff(b)*(a[-1]+a[-length(a)]))/2)   for some reason i get an error message: Error in FUN(newX[[, i],