Displaying 20 results from an estimated 8000 matches similar to: "Recode issue"
2010 Jun 09
1
[R-sig-Geo] How to extract coordinates values from a shapefile?
I'm not sure if this is what you want. But the function coordinates() in sp
package gives you the coordinates of SpatialObjects.
Regards.
Rodrigo.
2010/6/9 Nikhil Kaza <nikhil.list@gmail.com>
> You need to execute gpclibPermit() to enable gpclib.
>
> library(maptools) should have issued a warning to that effect.
>
>
> Nikhil Kaza
> Asst. Professor,
> City and
2009 Mar 01
1
Understanding Anova (car) output
Dear professor Fox and R helpers,
I have a quick question about the Anova function in the car package.
When using the default "type II" SS I get results that I don't
understand (see below).
library(car)
Data <- data.frame(y=rnorm(10), x1=factor(c(rep("a",4), rep("b",6))),
x2 = factor(c(rep("j", 2), rep("k", 3), rep("j", 2),
2011 Aug 22
3
automatic file input
Dear all,
I have 100 files which are used as input.and I have to input the name of my files again and again.the name of the files are 1.out, 2.out......100.out.
I want to know if there is anything like perl so that i can use something like this-
for($f = 1; $f <= 100; $f++) {
$file = $f.".out";
I have tried this thing in R but it does not work.Can somebody please help me.
2010 Jul 19
2
replacing elements of distance matrix
Hi! I am trying to implement non-bipartite matching. I have around 500 sites
which can be clustered by 10 regions. I am able to calculate pairwise
Mahalanobis distances between sites (thanks to another post in the forum).
However, I want to constrain my match to sites within the same region. Thus
I want to replace elements of the distance matrix with a high value, say
999999, for sites not of the
2011 Feb 11
6
linear models with factors
i am trying to fit a linear model with both continuous covariates and
factors. When fitted with the intercept
term the first level of the factor is treated by R as intercept and the
estimate of the effects of remaining levels(say i th level) are given as
true estimate of i th level - estimate of 1st level.can any please help me?
thanks in advance.....
--
View this message in context:
2003 Dec 06
1
recode{car} does not work as expected?
Hi to all,
I am having a problem when using recode from the car package. I have
a variable that is char and when I use recode to create a new
variable that is supposed to be numeric I get a factor variable. Here
is the code I am using:
> FCI$PRE1 <- recode (PRE1RES, " c('C', 'c')=1 ; else = 0 ;
as.factor.result=FALSE ")
So, if I understand correctly the recode
2010 Jun 15
1
Problem with the recode function
Hello,
I am using the recode() function in Rcmdr and the result is not what I
expect so I am almost sure I did something wrong but what...
> test <- data.frame(x=1:10)
> library(car)
> recode(test$x,'1:5=0 ; else=1', as.factor.result=TRUE)
[1] 0 0 0 0 0 1 1 1 1 1
Levels: 0 1
BUT
> library(Rcmdr) # recode from the car package is now masked
Now I recode test$x
2011 Jul 25
4
ggplot question: changing the label for the Y axis on a histogram
Some help with how to re-label the vertical axis in a histogram would be appreciated.
qplot(off.sc,weight=rel.freq,binwidth=.29,main="test Figure"+ylab("New from inside"))+ylab("New from outside")+
xlab("off.sc\nAggregated frequency plots for 17 equal intervals.")
The code
2010 Aug 03
4
Need help on upper.tri()
HI, I am really messing up to make a symmetrical matrix using upper.tri() & lower.tri() function. Here is my code:
> set.seed(1)
> mat = matrix(rnorm(25), 5, 5)
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 0.91897737
[2,] 0.1836433 0.4874291 0.3898432 -0.01619026 0.78213630
[3,] -0.8356286 0.7383247
2011 Mar 11
4
Any existing functions for reading and extracting data from path names?
Hi helpeRs,
I have inherited a set of data files that use the file system as a
sort of poor man's database, i.e., the data files are nested in
directories that indicate which city they come from. For example:
dir.create("deleteme")
for(i in paste("deleteme", c("New York", "Los Angeles"), sep="/")) {
dir.create(i)
for(j in
2005 Jul 28
1
Unexpected behavior in recode{car}
Thanks to the R creators for such a great statistical system. Thanks to
the R help list, I have (finally) gotten far enough in R to have a
question I hope to be worth posting.
I'm using the recode function from John Fox's car package and have
encountered some unexpected behavior.
Consider the following example:
## Begin cut-and-paste example
require( car )
set.seed(12345)
nn <-
2009 Nov 20
2
Finding & replacing non-ASCII characters
Hi guys,
Are there any feasible methods in searching & finding non-ASCII characters
in R?
For example, from the following object,
x <- mia. SzaÌmitaÌó
The desired output is,
x.out <- mia. SzaImitaIA
Your help in resolving this would be greatly appreciated.
[[alternative HTML version deleted]]
2003 Nov 04
2
line breaks in recode
Dear all,
it seems to be that 'recode' can't handle any line breaks in its code.
The following command causes no problem:
datameta$smpid.r <-
recode(datameta$smpid,"c(101,25,167,45,75)=25;c(104,51)=51")
But if I type ...
datameta$smpid.r <-recode(datameta$smpid,
"c(101,25,167,45,75)=25;
c(104,51)=51")
... the result is a syntax error.
2008 Jan 07
1
recode() function results in logical output, not factor output
Dear R Users:
I have race-ethnicity groups identified in the factor variable Ethnic_G.
I need to collapse Ethnic_G into a new variable with only two factors, 1 (White, non-Hispanic) and 2 (Minority).
As seen in the code and output below, the recoded race-ethnicity variable is put into logical format, not factor format.
I've used library(car) and the package was updated.
Any ideas on
2011 Feb 21
2
Equivalent of log file in R?
Hi everyone,
Is there a way to make R save the workspace output (just the results,
not the objects themselves) as you go? I'm running analysis that takes
a long time to run and I want to be able to interrupt it without
losing all the output to date. Is there an alternative to putting
"save.image()" commands after every couple lines of code?
Best,
Tatyana
2011 Jul 29
1
Apostrophes in R Commander in recode
Dear colleagues,
I'm using R64 (2.13) on Mac OS 10.6.8 and I've encountered a problem with the recode function in Rcommander. The application cannot deal with apostrpohes ( ' ) do not. I've got a factor from the 2008 Canada Election study (highest level of schooling) and some of the values include "Bachelor's Degree" , "Master's Degree".
I've
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
2008 Mar 27
1
Recode factors
I know this comes up, but I didn't see my exact issue in the archives. I
have variables in a dataframe that need to be recoded. Here is what I'm
dealing with
I have a factor called aa
> class(aa)
[1] "factor"
> table(aa)
aa
* 0 1 2 3 A B C D L N T
0 0 1908 725 2089 0 0 67 0 0 2 1 6
I need to recode
2011 Oct 03
1
function recode within sapply
Dear List,
I am using function recode, from package car, within sapply, as follows:
L3 <- LETTERS[1:3]
(d <- data.frame(cbind(x = 1, y = 1:10), fac1 = sample(L3, 10,
replace=TRUE), fac2 = sample(L3, 10, replace=TRUE), fac3 = sample(L3,
10, replace=TRUE)))
str(d)
d[, c("fac1", "fac2")] <- sapply(d[, c("fac1", "fac2")], recode,
"c('A',
2010 Apr 07
2
recoding variables-recode not working
Hi,
I have numerical variable that I want to recode into categories '0' and '1
and more' and do analysis with that data.
I have tried various of possibilities to do so, but I am sucked and nothing
is working.
recode(Q12, "0='A';1:30='B'")
cut(Q12, breaks=c(0,1,30), lables=c('0', '1 and more'))
cat(Q12, "0=0;1-33=1")
What should