similar to: Reassign Multiple Factors to same Factor Value

Displaying 20 results from an estimated 10000 matches similar to: "Reassign Multiple Factors to same Factor Value"

2010 Nov 05
4
assignment operator saving factor level as number
Hi all, I have a dataframe (df1) that I am trying to select values from to a second dataframe that at the current time is only for the selected items from df1 (df2). The values that I am trying to save from df1 are factors with alphanumeric names df1 looks like this: 'data.frame': 3014 obs. of 13 variables: $ Num : int 1 1 1 2 2 2 3 3 3 4 ... $ Tag_Num : int 1195
2004 Feb 05
2
Histograms by two factors
Hi I am trying to print out means, STDs and histograms under two sets of factors. I can manage it for one set - see below but not for two sets. That is, I want ot print out the mean STD and Histogram for each ITEM code within each DELIVERABLE code. In addition I can only get to view the histogram for the last item. How do you get R to stop overriding the histogram for eg level 1 for factor 1
2017 Jun 23
4
duplicated factor labels.
Hmm, the danger in this is that duplicated factor levels _used_ to be allowed (i.e. multiple codes with the same level). Disallowing it is what broke read.spss() on some files, because SPSS's concept of value labels is not 1-to-1 with factors. Reallowing it with different semantics could be premature. I mean, if we hadn't had the "forbidden" step, read.spss() could have changed
2013 May 01
2
Factors and Multinomial Logistic Regression
Dear All, I am trying to reproduce the example that I found online here http://bit.ly/11VG4ha However, when I run my script (pasted at the end of the email), I notice that there is a factor 2 between the values for the coefficients for the categorical variable female calculated by my script and in the online example. Any idea about where this difference comes from? Besides, how can I
2018 Mar 22
1
Calculate weighted proportions for several factors at once
Hi, I have a grouped data set and would like to calculate weighted proportions for a large number of factor variables within each group member. Rather than using dplyr::count() on each of these factors individually, the idea would be to do it for all factors at once. Does anyone know how this would work? Here is a reproducible example: ############################################################
2019 Jul 09
3
[R] Curl4, Quantmod, tseries and forecast
Hi Ralf, I tried the following > install.packages("RCurl") which went OK, but then same story when I tried to install tseries. > sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 10 (buster) Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0 LAPACK:
2013 Mar 24
3
Parallelizing GBM
Dear All, I am far from being a guru about parallel programming. Most of the time, I rely or randomForest for data mining large datasets. I would like to give a try also to the gradient boosted methods in GBM, but I have a need for parallelization. I normally rely on gbm.fit for speed reasons, and I usually call it this way gbm_model <- gbm.fit(trainRF,prices_train, offset = NULL, misc =
2007 Apr 05
17
Reasons to Use R
Dear All, The institute I work for is organizing an internal workshop for High Performance Computing (HPC). I am planning to attend it and talk a bit about fluid dynamics, but there is also quite a lot of interest devoted to data post-processing and management of huge data sets. A lot of people are interested in image processing/pattern recognition and statistic applied to geography/ecology, but I
2013 Feb 09
3
Addressing Columns in a Data Frame
Dear All, Probably a one liner, but I am banging my head against the floor. Consider the following DF <- data.frame( x=1:10, y=10:1, z=rep(5,10), a=11:20 ) mn<-names(DF) but then I cannot retrieve a column by doing e.g, DF$mn[2] I tried to play with the quotes and so on, but so far with no avail. Any suggestion is welcome. Cheers Lorenzo
2010 Nov 03
2
biding rows while merging at the same time
Hello! I have 2 data frames like this (well, actually, I have 200 of them): df1<-data.frame(location=c("loc 1","loc 2","loc 3"),date=c("1/1/2010","1/1/2010","1/1/2010"), a=1:3,b=11:13,c=111:113) df2<-data.frame(location=c("loc 1","loc 2","loc
2009 Jul 20
3
Histograms on a log scale
Dear All, I would like to be able to plot histograms/densities on a semi-log or log-log scale. I found several suggestions online http://tolstoy.newcastle.edu.au/R/help/05/09/12044.html https://stat.ethz.ch/pipermail/r-help/2002-June/022295.html http://www.harding.edu/fmccown/R/#histograms Now, consider the code snippet taken from http://www.harding.edu/fmccown/R/#histograms # Get a random
2011 Dec 15
3
From Distance Matrix to 2D coordinates
Dear All, I am struggling with the following problem: I am given a NxN symmetric matrix P ( P[i,i]=0, i=1...N and P[i,j]>0 for i!=j) which stands for the relative distances of N points. I would like use it to get the coordinates of the N points in a 2D plane. Of course, the solution is not unique (given one solution, I can translate or rotate all the points by the same amount and generate
2007 Aug 08
2
Relocating Axis Label/Title --2
Apologies for the previous mail (I sent it off too early by mistake). This is the correct example: rm(list=ls()) D_mean<-seq(-5,5,length=100) y<-exp(-D_mean^2/5) pdf("my.pdf") plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black", ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))), xlab = expression(paste(D[agg],"
2011 Feb 02
1
Merging by factor variables
I'm wondering about the behavior of the merge function when using factors as by variables. I know that when you combine two factors using c() the results can be odd, as in: c(factor(1:5),factor(6:10)) which prints: [1] 1 2 3 4 5 1 2 3 4 5 I presume this is because factors are actually stored as integers, with 6,7,8,9,10 stored internally as 1,2,3,4,5. This concerns me somewhat, as I often
2012 Oct 26
2
Stata Database & R
Dear All, I am given some data to analyze. The data is in the form of a Stata database (.dta file). What is the best way to import it into an R dataframe? Is there any particular caveat I should be aware of? Many thanks Lorenzo
2008 Sep 14
5
difference of two data frames
Hello I have 2 data frames DF1 and DF2 where DF2 is a subset of DF1: DF1= data.frame(V1=1:6, V2= letters[1:6]) DF2= data.frame(V1=1:3, V2= letters[1:3]) How do I create a new data frame of the difference between DF1 and DF2 newDF=data.frame(V1=4:6, V2= letters[4:6]) In my real data, the rows are not in order as in the example I provided. Thanks much Joseph [[alternative HTML version
2012 Oct 05
2
Test for Random Points on a Sphere
Dear All, I implemented an algorithm for (uniform) random rotations. In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian coordinates. The result is supposed to be a set of random, uniformly distributed, points on a sphere (not the point of the algorithm, but a way to test it). This is what the points look like when I plot them, but other then eyeballing them, can anyone
2009 May 27
2
Factor level with no cases shows up in a plot
Consider this data structure (df1) ... Group Year PctProf FullYr 1 Never RF 2004 87 88 2 Cohort 1 2004 83 84 3 Cohort 2 2004 84 86 4 Cohort 3 2004 87 87 5 Cohort 4 2004 73 74 6 Never RF 2005 85 86 7 Cohort 1 2005 81 82 8 Cohort 2 2005 81 81 9 Cohort 3 2005 78 79 10 Cohort 4 2005 72 74 11
2013 Feb 26
2
merging or joining 2 dataframes: merge, rbind.fill, etc.?
#I want to "merge" or "join" 2 dataframes (df1 & df2) into a 3rd (mydf). I want the 3rd dataframe to contain 1 row for each row in df1 & df2, and all the columns in both df1 & df2. The solution should "work" even if the 2 dataframes are identical, and even if the 2 dataframes do not have the same column names. The rbind.fill function seems to work. For
2011 Aug 18
2
Best way/practice to create a new data frame from two given ones with last column computed from the two data frames?
Dear expeRts, What is the best approach to create a third data frame from two given ones, when the new/third data frame has last column computed from the last columns of the two given data frames? ## Okay, sounds complicated, so here is an example. Assume we have the two data frames: df1 <- data.frame(Year=rep(2001:2010, each=2), Group=c("Group 1","Group 2"), Value=1:20)