similar to: Using functions/loops for repetitive commands

Displaying 20 results from an estimated 1000 matches similar to: "Using functions/loops for repetitive commands"

2018 Apr 18
3
Problem with regression line
Hello, I am trying to graph a regression line using the followings: Age <- c(39, 47, 45, 47, 65, 46, 67, 42, 67, 56, 64, 56, 59, 34, 42, 48, 45, 17, 20, 19, 36, 50, 39, 21, 44, 53, 63, 29, 25, 69) BloodPressure <- c(144, 220, 138, 145, 162, 142, 170, 124, 158, 154, 162, 150, 140, 110, 128, 130, 135, 114, 116, 124, 136, 142, 120, 120, 160, 158, 144, 130, 125, 175) SimpleLinearReg1=lm(Age ~
2010 Nov 04
5
Logical vectors
Hi folks, Pls help me to understand follow; An Introduction to R 2.4 Logical vectors http://cran.r-project.org/doc/manuals/R-intro.html#R-and-statistics 1) > x [1] 1 2 3 4 5 > temp <- x != 1 > temp [1] FALSE TRUE TRUE TRUE TRUE > 2) > x [1] 1 2 3 4 5 > temp <- x > 1 > temp [1] FALSE TRUE TRUE TRUE TRUE Why NOT > temp [1] TRUE FALSE FALSE FALSE
2010 Nov 04
5
Logical vectors
Hi folks, Pls help me to understand follow; An Introduction to R 2.4 Logical vectors http://cran.r-project.org/doc/manuals/R-intro.html#R-and-statistics 1) > x [1] 1 2 3 4 5 > temp <- x != 1 > temp [1] FALSE TRUE TRUE TRUE TRUE > 2) > x [1] 1 2 3 4 5 > temp <- x > 1 > temp [1] FALSE TRUE TRUE TRUE TRUE Why NOT > temp [1] TRUE FALSE FALSE FALSE
2018 Apr 18
0
Problem with regression line
Hi, Anne, assign Age and Bloodpressure in the correct order to the axes in your call to plot as in: plot(y = Age, x = BloodPressure) abline(SimpleLinearReg1) Hth -- Gerrit --------------------------------------------------------------------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen Tel:
2018 Jan 17
0
effects & lme4: error since original data frame notfoundWASeffects: error when original data frame is missing
Dear Gerrit, This issue is discussed in a vignette in the car package (both for functions in the car and effects packages): vignette("embedding", package="car") . The solution suggested there is the essentially the one that you used. I hope this helps, John ----------------------------- John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada Web:
2018 Jan 17
0
effects & lme4: error since original data frame not found WASeffects: error when original data frame is missing
Hi, again, I have to modify my query since my first (too simple) example doesn't reflect my actual problem. Second try: When asking Effect() inside a function to compute an effect of an lmer-fit which uses a data frame local to the body of the function, as in the following example (simplifying my actual application), I get the "Error in is.data.frame(data) : object 'X' not
2018 Jan 17
4
effects: error when original data frame is missing
Hello, everyody, when asking, e.g., Effect() to compute the effects of a fitted, e.g., linear model after having deleted the data frame from the workspace for which the model was obtained an error is reported: > myair <- airquality > fm <- lm(Ozone ~ Temp, data = myair) > rm(myair) > Effect("Temp", fm) Error in eval(model$call$data, envir) : object 'myair'
2012 Mar 27
2
Supperscript, subscript and double lines in the main/sub title and using greek letters
Dear R-help, I am trying to express myself as best as I can here. If you also use Latex to edit math reports or other languages with similar editing method, you'll see what I'm talking about. My sincere appologies if my question is not clear enough to some extend, as also I'm not able to provide my code here because I don`t know which one I can use... When editing the title in R
2018 Jan 09
1
barplot_add=TRUE
Dear Gerrit Thanks a lot. "rbind" seems to be the right function. Unfortunately there is a shift in the x-axis (see pdf). There are 52 trapcatch values each, m and w, but m$trapcatch and w$trapcatch are shifted up to x-value 60. The follow-up lines for temp and humidity are fine. Thanks Sibylle setwd("~/Desktop/DatenLogger2017") # am Mac sks trap =
2005 Mar 22
2
lattice xyplot() postscript (?) problem in R 2.0.0
Dear all, I work with R Version 2.0.0 on Machine hardware: sun4u OS version: 5.9 Processor type: sparc Hardware: SUNW,Sun-Blade-1000 and I have a very simple data frame (called OR) with the following variables: > sapply( OR, class) X ci FTyp "factor" "numeric" "factor" (In OR$ci there are some Inf-values. OR's
2012 Jun 27
4
formula version of sunflowerplot() fails when axis label specified
Hello, R-help, does anybody have already a work-around for the problem that the formula version of sunflowerplot() throws an error when provided with a value for xlab (or ylab) different from NULL: > sunflowerplot( Sepal.Length ~ Sepal.Width, data = iris, xlab = "A") Error in model.frame.default(formula = Sepal.Length ~ Sepal.Width, data = iris, : variable lengths differ
2009 Aug 27
2
Comparing and adding two data series
Dear R helpers   I have two series A and B as given below -   A <- c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B <- c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0.2282, 0.1614)   I need to calculate the total in dataset B corresponding to the numbers in dataset A i.e. for no 1 in A, I need the total as 4.0140+0.3798 (as 1 is repeated twice) for no 2, I need the total as
2010 Dec 14
3
Question about cut()
Dear all, I would like to use cut() to make numerics to factors, the sample codes are as follows. However, the result is not what I want, since r[3] =?9 should be in the interval of "8-10%" rather than "2-4%". Maybe cut() is not the right function to use for my situation. Please help. > r <- c(1,1,9,1,1,1) > col_no <-
2018 Jan 09
3
barplot_add=TRUE
Dear R users aim Barplot of insect trap catches (y variable trapcatch) at one specific station (variable FiBL_Hecke) from week 1-52 ( x variable week). It works well using the function tapply (sum trapcatch per week, males and females not separated), however, I intend to separate the y variable trapcatch in males and females (variable m_w: m and w) problem I used the function "add" to
2013 Apr 05
1
mixed formatting of integer and numeric (e. g., by summary.default())
Hello, eveRybody, I've been trying to find the origin for the following formatting-"inconsistency": E. g., look at the number of digits in summary.defaults()'s output when NAs occur: in my example below the number of NA's is displayed as an integer, the rest as numeric (floating point numbers): > summary.default( c( 1:2, NA)) Min. 1st Qu. Median Mean 3rd Qu.
2010 Nov 18
3
problems subsetting
Dear all, I have searched the forums for an answer - and there is plenty of questions along the same line - but none of the paproaches shown worked to my problem: I have a data frame that I get from a csv: summarystats<-as.data.frame(read.csv(file=f_summary)); where I have the columns Dataset, Class, Type, Category,.. Problem1: I want to find a subset of this frame, based on values in
2018 Jan 09
0
barplot_add=TRUE
Hi, Sibylle, since you write '"mathematically" add', does barplot(rbind(m$trapcatch, w$trapcatch)) do what you want (modulo layout details)? Hth -- Gerrit --------------------------------------------------------------------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen Tel:
2018 Apr 18
1
Problem with regression line
Hi Anne, I would suggest to change the linear model to lm(BloodPressure~Age), as this model makes more sense in biological means (you would assume that age influences pressure, not vice versa) and also obeys the statistical assumption of weak exogeneity, that age can be measured without error, at least compared to error-prone bp measures. Cheers Am 18.04.2018 um 16:07 schrieb Gerrit Eichner:
2008 May 23
1
Evaluation "conflict" in combination of replicate() and rexp()as variable inside a function
Dear userRs, "playing around" with combinations of replicate() and random number generating functions inside a self-defined "wrapper" function I encounterd a puzzling behaviour. The following are intentionally simple (and rather nonsense-) examples to isolate the relevant aspects. Please, note the seemingly "inconsistent" behaviour for the second call of
2011 Mar 15
1
Data Frame Variable Names
Hi, I have created a dataframe (lets call is df) that contains the following variables "Dependent1" "Dependent2" Dependent3" "Independent1" I want to do the following regressions: z<- glm( df$Dependent1 ~ df$Independent1) z<- glm( df$Dependent2 ~ df$Independent1) z<- glm( df$Dependent3 ~ df$Independent1) and so on I wanted to put this in a for