similar to: apply the function "factor" to multiple columns

Displaying 20 results from an estimated 600 matches similar to: "apply the function "factor" to multiple columns"

2005 May 26
2
read.spss in R 2.1.0 & make basic dataframe
Recent changes to read.spss() in the foreign package return a dataframe containing additional attributes. For example, >TEMP<-read.spss(choose.files(), to.data.frame=T,use.value.labels=F) > str(TEMP) `data.frame': 780 obs. of 8 variables: $ EXPOS01: atomic 1 1 2 1 2 3 2 4 2 1 ... ..- attr(*, "value.labels")= Named num 5 4 3 2 1 .. ..- attr(*,
2012 Apr 25
1
recommended way to group function calls in Sweave
Dear all When using Sweave, I'm always hitting the same bump: I want to group repetitive calls in a function, but I want both the results and the function calls in the printed output. Let me explain myself. Consider the following computation in an Sweave document: summary(iris[,1:2]) cor(iris[,1:2]) When using these two calls directly, I obtain the following output: > summary(iris[,1:2])
2009 Sep 29
1
Summary
My data is called xc and has more than 15 variables. When I used summary(xc) it gave me the detail description of each variable. Summary(xc) Y1 x1 x2 x3 .. Min. :0.0000 Min. : 1.000 Min. : 1.000 Min. : 1.000 1st Qu. :0.0000 1st Qu.: 1.000 1st Qu.: 1.000 1st Qu.: 2.000 Median :1.0000 Median : 1.000
2016 Apr 14
4
Bug in by() function which works for some FUN argument and does not work for others
Dear Sirs, I am Professor at Indira Gandhi Krishi Vishwavidyalaya, Raipur, Chhattisgarh, India. While taking classes, I found the *by() *function producing following error when I use FUN=mean or median and some other functions, however, FUN=summary works. Given below is the output of the example I used on a built-in dataset "mtcars", along with error message reproduced herewith: >
2016 Apr 14
0
Bug in by() function which works for some FUN argument and does not work for others
I think you are not using the best function for what your intentions are. Try: > by(data=mtcars, INDICES=list(as.factor(mtcars$am)), FUN=colMeans) : 0 mpg cyl disp hp drat wt qsec vs 17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947 18.1831579 0.3684211 am gear carb 0.0000000
2006 Jan 30
1
weights argument in the lmer function in lme4
I suspect the weights argument is not having any effect. Package: Matrix Version: 0.995-2 Date: 2006-01-19 Beginning with this: Browse[1]> resp.lmer <- lmer(SensSSC ~ Block + Season + (1 | Plot) + (1 | Ma) + (1 | Pa) + + (1 | MaPa), weights = SensSSC.N, data = xx) I group the output into a table with my ran.eff function and get this:
2016 Apr 15
4
Bug in by() function which works for some FUN argument and does not work for others
Dear All, Thanks for your help. However, I would like to draw your attention to the following: Actually, I was replicating the Example 2.3, using the dataset "brainsize.txt" given in Section 2.3.3 ("Summarize by group") at page 55, of a famous book "R by Example" written by "Jim Albert and Maria Rizzo" published in Springers (2012) in a Use R! Series. The
2009 Nov 23
2
non-intuitive behaviour after type conversion
Deal list, I have a data frame (birth) with mixed variables (numeric and alphanumeric). One variable "t1stvisit" was originally coded as numeric with values 1,2, and 3. After attaching the data frame, this is what I see when I use str(t1stvisit) $ t1stvisit: int 1 1 1 1 1 1 1 1 2 2 ... This is as expected. I then convert t1stvisit to a factor and to avoid creating a second
2016 Apr 15
0
Bug in by() function which works for some FUN argument and does not work for others
> On Apr 15, 2016, at 1:16 AM, Akhilesh Singh <akhileshsingh.igkv at gmail.com> wrote: > > Dear All, > > Thanks for your help. However, I would like to draw your attention to the > following: > > Actually, I was replicating the Example 2.3, using the dataset > "brainsize.txt" given in Section 2.3.3 ("Summarize by group") at page 55, > of a
2012 Jun 13
1
How to calculate the statistcs for extracted region?
I have a binary file(a) with size of (360 720 )for the globe.I wrote the code given below to read and extract an area (south america)from that file. when I use summary for the whole file I got: summary(a, na.rm=FALSE) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 0.00 1.00 3.00 4.15 7.00 20.00 200083 . But when I used summary for the region(b) which I extracted, I got
2016 Apr 16
2
Bug in by() function which works for some FUN argument and does not work for others
Dear All, I have got your core message, that it is my responsibility to determine whether any particular function in my version of R satisfies the language requirements at the time of your use. Jim Albert and Maria Rizzo must have used their code, which was permitted in the R-code of their time (2012). Therefore, I have now modified my R-code, as per R-3..2.4 version, according to my requirement
2009 Feb 18
2
Re place Values within vector using Translation vector
Dear everyone I would like to change values in vectors doing a translation. i.e. I have a start vector giving me the levels in one vector (numbers 1 to x - rating) and then I have a second vector giving me the values to be allocated (loss probabilities), but the number of potential rating classes and loss estimates is still subject to a lot of discussion. Attached a simplified version of the
1999 May 06
0
matrix weirdness
I am using R on unix version 63.0 I am doing an image plot of the following data file: ================================ lag1 lag2 cif2d 0.000 0.000 NaN 0.000 1.000 0.500000 0.000 2.000 0.489831 0.000 3.000 0.492986 0.000 4.000 0.493409 0.000 5.000 0.492727 0.000 6.000 0.494485 1.000 0.000 0.500000 1.000 1.000 NaN 1.000 2.000 0.495098 1.000 3.000 0.489831 1.000 4.000 0.492986 1.000 5.000
2011 Jul 25
1
lme convergence error
Hello, I am working from a linux 64 machine on a server with R-2.12 (I can't update to 2.13). I am iterating through many linear mixed models for longitudinal data and I occasionally receive the following convergence error: > BI.lme <- lme(cd4 ~ time + genBI + genBI:time + C1 + C2 + C11 + C12, random =~ 1 + time | IID, data = d) Error in lme.formula(cd4 ~ time + genBI + genBI:time +
2016 Apr 17
0
Bug in by() function which works for some FUN argument and does not work for others
> On Apr 16, 2016, at 2:03 AM, Akhilesh Singh <akhileshsingh.igkv at gmail.com> wrote: > > Dear All, > > I have got your core message, that it is my responsibility to determine whether any particular function in my version of R satisfies the language requirements at the time of your use. Jim Albert and Maria Rizzo must have used their code, which was permitted in the R-code
2008 Nov 20
5
summary statistics into table/data base, many factors to analyse
Dear list, I reduced my data to the following: x <- c(1,4,2,6,8,3,4,2,4,5,1,3) y <- as.factor(c(2,2,1,1,1,2,2,1,1,2,1,2)) z <- as.factor(c(1,2,2,1,1,2,2,3,3,3,3,3)) I can produce the statistical summary just fine. s1 <- tapply(x, y, summary) d1 <- tapply(x, y, sd) s2 <- tapply(x, z, summary) d2 <- tapply(x, z, sd) First thing: I have 100 plus factors to analyse. Theirs
2007 Oct 29
2
help please
hello, please can anyone help me out. Am a new user of R program. Am having problem with this code below, not getting the expected results. Each m, the cumulative sum should be 1.000 but the 2nd and 3rd m returned 2.000 and 3.000 instead of 1.000. thanks Aruike pp=function(x,n,M){z=1.0;a=2.3071430;b=7.266064;H=3 out.h=c() out.y=c() out.m=c() out.prob=c()
2020 Sep 21
2
Help with the Error Message in R "Error in 1:nchid : result would be too long a vector"
Hello everyone, I am using *mlogit* to analyse my choice experiment data. I have *3 alternatives* for each individual and for each individual I have *9 questions*. I have a response from *516 individuals*. So it is a panel of 9*516 observations. I have arranged the data in long format (it contains 100 columns indicating different variables and identifiers). In mlogit I tried the following
2006 Dec 14
5
Nicely formatted tables
If I use latex(summary(X)) where X is a data frame with four variables I get something like Rainfall Education Popden Nonwhite Min. :10.00 Min. : 9.00 Min. :1441 Min. : 0.80 1st Qu.:32.75 1st Qu.:10.40 1st Qu.:3104 1st Qu.: 4.95 Median :38.00 Median :11.05 Median :3567 Median :10.40 Mean :37.37 Mean :10.97 Mean :3866
2007 Oct 26
5
help
hello, please can anyone help me out. Am a new user of R program. Am having problem with this code below, not getting the expected results. 1. Each m, the cumulative sum should be 1.000 but the 2nd and 3rd m returned 2.000 and 3.000 instead of 1.000. 2. to get the LCL(m) and UCL(m) for each m base on these instructions if out.cum > 0.025 then LCL(m)= y-1 if out.cum >0.975