yes, the argument "labels" it's working fine!
It would be great if the docs will be be updated also with this already
implemented feature
thank you for your valuable work
best
max
Il 13/08/2012 15:09, Uwe Ligges ha scritto:
On 13.08.2012 12:12, maxbre wrote:
given this example
library(c
Apology. Will investigate ?segments. But this is simpler than that ?
think<-20
xc<-c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40)
yc<-c(2.2, 2.28454054054054, 2.37536982774792, 2.4731342109
Hi Mohan,
Your code isn't reproducible as is: see
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
for more information on how you can help us help you.
That said, I think you are looking for the ?segments function.
Cheers,
Michael
On Tue, Aug 14, 2012 at
Hi,
plot(xc, yc, type="l", ylim=c(0,50), xlim=c(0,50), lwd=2, xlab="M",
ylab="seconds")
abline(a=-think, b=cpustime, lty="dashed", col="red")
abline( 2.2, 0, lty="dashed", col = "red")
This draws a response time curve an asymptote and a horizontal line. How
do I draw a line from the in
Dear Abraham,
It's not entirely clear to me what you want to plot. If you want the "effect
display" for each predictor holding the others to typical values,
plot(allEffects(md1)) will do that.
But you appear to want to plot fitted probabilities for combinations of the
predictors even though the
key1.=c(1, 2, 3)
key2.=c(2)
if (identical(key1.,key2.) == "TRUE") {
cat("No Errors found")
}
if (length(setdiff(key1., key2.)) !=0){
On Mon, Aug 13, 2012 at 5:10 AM, aleksandr russell wrote:
> Hello,
>
> I'm hoping someone with a wide experience with R may be able to see
> what the program is trying to tell me.
>
> I've got an array:
>
> y1=rnorm(41,0.2)
> y2=rnorm(41,0.2)
> y3=rbind(y1,y2)
>
>
>
> data11<-array(0,c(41,2,2))
>
Hi Nooshin,
It's a common enough request, but it's simply not a well defined
problem so unless you specify further, we can't help you. (I.e., the
information you give doesn't uniquely parameterize a multivariate
distribution)
With that said, you may want to look at ?sample for basic resampling.
On Sun, Aug 12, 2012 at 10:58 PM, Louise Cowpertwait
wrote:
> Hi there,
>
> I have subscribed to R-help but am not sure how to view or post questions? I
> think this is the right way.
Indeed!
>
> I am planning on doing a multivariate regression investigating the
> relationship between depressi
Hi all
I´ve got a problem using boxcox.nls function in nlrwr packagge. I´m fitting
several non
linear models to these data:
> x
[1] 2 1 1 5 4 6 13 11 13 101 101 101
> y
[1] 1.281055090 1.563609934 0.001570796 2.291579783 0.841891853
[6] 6.553951324 14.243274230 14.51989
Please keep your replies on list so you can ask a wider audience. In this case,
I haven't used Windows in years, so someone else will have to take a look.
I do think you probably need to use Sys.setenv() to change the locale from
within R
Cheers,
Michael
On Aug 13, 2012, at 11:27 PM, Derrick
HI,
CPU time used:
n<-1e6
system.time({
set.seed(1)
dat1<-data.frame(col1=sample(1:5,n,replace=TRUE))
getcol2<-function(dat1){
dat1$col2[dat1$col1<=2]="L"
dat1
}
dat1<-getcol2(dat1)
})
#user system elapsed
# 0.096 0.000 0.095
system.time({
set.seed(1)
dat1<-data.frame(col1=sample(1
HI,
Check this link:
https://stat.ethz.ch/pipermail/r-help/2011-April/273858.html
A.K.
- Original Message -
From: Sachinthaka Abeywardana
To: r-help@r-project.org
Cc:
Sent: Monday, August 13, 2012 10:09 PM
Subject: [R] anova in unbalanced data
Hi all,
Say I have the following data
HI,
Try this:
getcol2<-function(data){
data$col2[data$col1<=2]="L"
data
}
data<-getcol2(data)
data
# col1 col2
#1 1 L
#2 2 L
#3 3
#4 4
#5 5
A.K.
- Original Message -
From: Sachinthaka Abeywardana
To: r-help@r-project.org
Cc:
Sent: Monday, August 13, 2012
What's your sessionInfo()? And how did you Change the locale? And what was your
actual plot command and graphics device?
Michael
On Aug 13, 2012, at 10:17 PM, Derrick Guan wrote:
> Dear R-help mailing list,
>
> I have a drawing problem with R:
>
> I need to draw an horizontal axis with date,
Dear R-help mailing list,
I have a drawing problem with R:
I need to draw an horizontal axis with date, here is the test code:
> ticks <- c("2004-01-22","2005-01-22","2006-01-22","2007-01-
22","2008-01-22","2009-01-22","2010-01-22","2011-01-22","2012-01-22")
> ats <- ticks[seq(1,length(ticks))]
With multiple predictors, I feel that predict ends up being less elegant.
Plus, I've found a lot of the
simple log-odds plots available in the effect package to be simple and easy
to use as compared to
base predict.
On Mon, Aug 13, 2012 at 3:01 PM, Bert Gunter wrote:
> Why not use
>
> ?predict.g
Why not use
?predict.glm ## with type = "response" ?
-- Bert
On Mon, Aug 13, 2012 at 12:39 PM, Abraham Mathew wrote:
> I'm trying to run a logit model and plot the probability curve for a number
> of the important predictors. I'm trying to do this
> with the Effects package.
>
>
> df=data.fram
Well I got my answer. Thanks again Rui.
On Mon, Aug 13, 2012 at 9:24 PM, Avishek Dutta wrote:
> Thanks A LOT, I will keep this in mind!
>
>
> On Mon, Aug 13, 2012 at 9:15 PM, Rui Barradas wrote:
>
>> If you intend to use R code in a package, or to source() it, or to be
>> called by an external s
Sachinthaka Abeywardana escreveu:
>Think you are missing the point,
As lover of C-style pointers, I must admit that hiding complexities (and
associated problems) of pointers is a great feature of all successful high
level languages (HLLs). As much as they spare time and can be easily learned by
Hi all,
Say I have the following data:
a<-data.frame(col1=c(rep("a",5),rep("b",7)),col2=runif(12))
a_aov<-aov(a$col2~a$col1)
summary(aov)
Note that there are 5 observations for a and 7 for b, thus is
unbalanced. What would be the correct way of doing anova for this set?
Thanks,
Sachin
Then you can consider storing the object in an environment and
changing it there. If you like side effects, and passing by
reference, there is always C.
On Mon, Aug 13, 2012 at 9:30 PM, Sachinthaka Abeywardana
wrote:
> Think you are missing the point, assigning the value back is the same as
> pa
On Aug 13, 2012, at 9:30 PM, Sachinthaka Abeywardana
wrote:
> Think you are missing the point, assigning the value back is the same as
> passing by value. This is rather inefficient if you ever have to deal with
> large datasets. You dont want to keep having a local copy within the scope
> of
On Aug 13, 2012, at 9:23 PM, Sachinthaka Abeywardana
wrote:
> Hi Jim, R,
>
> What you just showed me simply prints out the 2nd column. If you inspect
> your original data, it still just has 1 column. So its still passing by
> value.
Yes -- that's entirely by design. Look into functional prog
Think you are missing the point, assigning the value back is the same as
passing by value. This is rather inefficient if you ever have to deal with
large datasets. You dont want to keep having a local copy within the scope
of the function and then copying over the original.
On Tue, Aug 14, 2012 at
The assign the value back to the object:
> data<-data.frame(col1=c(1,2,3,4,5))
>
> getcol2<-function(data){
+ data$col2[data$col1<=2]="L"
+ data # return value
+ }
>
> data <- getcol2(data) # save the return value
> data
col1 col2
11L
22L
33
44
55
>
On
Hi Jim, R,
What you just showed me simply prints out the 2nd column. If you inspect
your original data, it still just has 1 column. So its still passing by
value.
Thanks,
Sachin
On Tue, Aug 14, 2012 at 11:19 AM, jim holtman wrote:
> You have to return the value of 'data' from the function. Fu
You have to return the value of 'data' from the function. Functions
do not have "side effects".
> data<-data.frame(col1=c(1,2,3,4,5))
>
> getcol2<-function(data){
+ data$col2[data$col1<=2]="L"
+ data # return value
+ }
>
> getcol2(data)
col1 col2
11L
22L
33
44
Hi all,
I want to do the following:
data<-data.frame(col1=c(1,2,3,4,5))
getcol2<-function(data){
data$col2[data$col1<=2]="L"
}
getcol2(data)
Unfortunately in the above col2 does not appear in the final data. So how
would you pass this by reference such that you would get it back?
Thanks,
Not really an answer but since you said something about "blessings"
and "spreading the word": I have a small presentation introducing the
time saving aspects of R comparing it to a programme called
Statistica that I used to use but that I now use mainly to convert its
native files to a rreadable f
On Mon, Aug 13, 2012 at 8:40 PM, Sachinthaka Abeywardana
wrote:
> Hi all,
>
> Is there a way to get cran R to set the working directory to be wherever
> the source file is? Each time I work on a project on different computers I
> keep having to set the working directory which is getting quite anno
When you close R it asks whether to save the workspace. I often say
"yes" and later start R by double clicking on that workspace (named
.Rdata) -- then the wd is automatically set. Alternatively you can
have setwd("X:/some/thing") at the beginning of your source file.
On Tue, Aug 14, 2012 at 3:40
Hi all,
Is there a way to get cran R to set the working directory to be wherever
the source file is? Each time I work on a project on different computers I
keep having to set the working directory which is getting quite annoying.
Thanks,
Sachin
[[alternative HTML version deleted]]
_
Hi Christian
I also think that latex is the way to go having to regularly produce
pdfs that are around 50-100+ pages.
Why use powerpoint when you have Beamer or other latex packages to
create a presentation.
You would have done most of the work in the thesis so use what you
have already don
Dear All,
Please see the short script at the end of the email, which I assembled
looking for bits and pieces on the web.
It essentially does what I need: it plots several countries as a
color-coded map.
I just would like to fine-tune a bit the final image, in particular
(1) Select my own col
You could do much worse than Bill Venables' short course presentation given at
UseR 2012.
Keep up the good work!
Michael
On Aug 13, 2012, at 3:13 PM, clangkamp wrote:
> Hi Everyone
>
> In the Contributed Documentation part of the R Project website there are
> dozens of various documents exp
Hi Everyone
In the Contributed Documentation part of the R Project website there are
dozens of various documents explaining this and that on R. Furthermore there
is also the document "Introduction to R". In my thesis I have been using R
here and there, so I would classify myself as an intermediate
I'm trying to run a logit model and plot the probability curve for a number
of the important predictors. I'm trying to do this
with the Effects package.
df=data.frame(income=c(5,5,3,3,6,5),
won=c(0,0,1,1,1,0),
age=c(18,18,23,50,19,39),
home=c(0,0,1,0,0,1)
Does this do what you need?
is.dup <- key %in% key[duplicated(key)]
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 8/13/12 4:07 AM, "Sri krishna Devarayalu Balanagu"
wrote:
>Thank you for the quick response.
>But
If you intend to use R code in a package, or to source() it, or to be
called by an external script, it's ALWAYS a good idea to make the
package where the functions come from explicit. In this case, and given
that it's working, use
foreign::write.dbf()
This is an example of the rule above.
Ru
Hello,
My earlier solution has a problem. If you have billions of counts over
~150 categories, it will recreate the full vectors every time you add a
new category, thus causing potential memory issues. Another, much more
complicated, way but using only the tables info is as follows.
twotabl
On Fri, Aug 10, 2012 at 05:41:07AM -0700, aajit75 wrote:
> Hi,
>
> I am new to R for solving optimization problems, I have set of communication
> channels with limited capacity with two types of costs, fixed and variable
> cost. Each channel has expected gain for a single communication.
> I want t
If you know all of the categories in advance, you can convert x and y to
factors and then sum the tables:
> x<-1:4
> y<-2:5
> x <- factor(x , levels=1:5) # list all possible categories
> y <- factor(y , levels=1:5)
> table(x)
x
1 2 3 4 5
1 1 1 1 0
> table(y)
y
1 2 3 4 5
0 1 1 1 1
> table(c(x,
Hello,
This one will do it.
x <- 1:4
y <- 2:5
t1 <- table(x)
t2 <- table(y)
(xy <- c(rep(names(t1), t1), rep(names(t2), t2)))
table(xy)
Hope this helps,
Rui Barradas
Em 13-08-2012 19:25, Francois Pepin escreveu:
Hi everyone,
Is there an easy way to combine the counts from table()?
Let's
There is grid.table in the gridExtra package
(http://code.google.com/p/gridextra/wiki/tableGrob), but for thesis
tables I think you're better off trying to solve the difficulties
you've been having with xtable. I can also recommend the latex
function in the Hmisc package, which makes it easier to d
Hello,
That means that there's a conflit between foreign::write.dbf and an
object in your R session, probably from another package. See (and post)
the output of
sessionInfo()
Rui Barradas
Em 13-08-2012 19:25, Avishek Dutta escreveu:
Hey,
Strangley, this is working
foreign::write.dbf(df,"H
In RStudio use
File > New > R Script
to make a script window (and file) and run it using
Code > Source
(or Control-Shift-S). The script will stop at the first error.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org
HI,
One more method to extract the code:
add1<-"200 W Rosamond St, Houston, TX 77076, USA"
sub(".*\\s.*\\s.*\\s.*\\s.*\\s.*\\s([[:digit:]]{5}).*","\\1",add1)
#[1] "77076"
#or,
sub(".*\\s+([[:digit:]]{5}).*","\\1",ttt)
#[1] "77076"
A.K.
- Original Message -
From: Erin Hodgess
To:
The below detection limit issue is similar to survival analysis with
censoring (but left rather than right censoring). So many survival
estimation approaches are thus appropriate for analyses with below
detection limits (see NADA package, also censored quantile regression in
quantreg package,
Hi, I am wondering whether some of you have a pointer to an alternative.
I am currently writing my thesis in Latex (several documents), well grown
over time, I am sure many of you are familiar with the situation. Likewise I
am doing the quantitative analysis with R, and again a lot of lines of more
Hi all;
I have a dataset for a 2 Group (Trial, Control) x 2 Time (T1, T2)
mixed-ANOVA design with missing values. We're interested in the main effect
of Group, main effect of Time and interaction between the two on PTI scores
(Pressure Time Integral; a continuous variable).
Does anyone have any c
Hi everyone,
Is there an easy way to combine the counts from table()?
Let's say that I have:
x<-1:4
y<-2:5
I want to replicate:
table(c(x,y))
using only table(x) and table(y) as input.
The reason is that it's cumbersome to carry all the values around when all I
care about are the counts. The
On 13.08.2012 17:10, Franckx Laurent wrote:
Dear all
I am trying to build a package, and get the error message: ""packaging into .tar.gz
failed"".
I have also installed the same package directly from a locally created zip file. In this
case, the package is put correctly under C:\R\R-2.15.0\l
There is also the chance that your sampling code is not correct.
Have you tried it out on, say, 5 dimensional data with increasing
numbers of samples?
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@
Hello,
It works with me,
d1 <- read.table(text="
ID simloglkhd
1 6.72782753120542
2 3.37685863056105
3 3.28498537979818
4 4.15888243774255
", header=TRUE)
d1
foreign::write.dbf(d1, "test.dbf")
d2 <- foreign::read.dbf("test.dbf")
identical(d1, d2) # FALSE
all(d1 == d2) # TRUE
attributes(d1
Dear Mr/Mrs
I need to generate a random data only with (0.23, 0.56, 0.45, 0.85, 0.7)
with known mean, SD, correlation length, in a matrix 50*50. I know R coeds
but in this case,
I could not find to generate only with finite numbers that I have. Please
guide me .
Best Regards
Nooshin
[[a
Perhaps ?Sys.sleep between scrapes. If this slows things down too much you may
be able to parallelize by host site with ?mclapply.
---
Jeff NewmillerThe . . Go Live...
DCN:Bas
On Aug 13, 2012, at 4:07 AM, Sri krishna Devarayalu Balanagu wrote:
Thank you for the quick response.
But I want those duplicated with Ids in a separate vector like
Duplicated.ids in the below example?
Duplication should be checked for Publication and Reference
combination, not on a single
On Mon, 13 Aug 2012, Bert Gunter wrote:
The proper approach is to use the proper approach: model it as
left-censored data. The problem with that is:
I'm trying to impute data below detection limit (with multiple detection
limits) so i need just a method or a code for imputation and then
extra
Indeed -- many of them (find a recent post on Pat Burns Portfolio Probe blog
for a comprehensive discussion) -- also see rugarch.
Michael
On Aug 13, 2012, at 8:17 AM, Sajeeka Nanayakkara wrote:
> Is there any R function to fit ARCH and GARCH models for univariate time
> series and to select
> Graph did not take right R color code.
> How can i solve this problem?,
One generally useful piece of advice would be to avoid using 'attach'.
Instead, try 'with'
Amend your data frame, and then do something like
with(machm, plot(xmach,ymach, xlim=c(-5,5),ylim=c(-5,5), pch=19,
cex=area*0.05,
Use the rugarch package - it's great, high quality.
On Mon, Aug 13, 2012 at 10:17 AM, Sajeeka Nanayakkara wrote:
> Is there any R function to fit ARCH and GARCH models for univariate time
> series and to select the best model?
>
>
> Sajeeka Nanayakkara
> [[alternative HTML version deleted
> I am trying to build a package, and get the error message:
> ""packaging into .tar.gz failed"".
Did the package pass an RCMD check first?
S
***
This email and any attachments are confidential. Any use...{{dropped:8}}
___
Greetings, I am running a factor analysis model in rjags and have
received the following error
Error parsing model file: syntax error on line 5 near ""
Line 5 is model {
Here is my syntax. Any insight would be greatly appreciated.
require(rjags)
modelstring = "
model {
for (i in 1 : nDat
Dear all,
I'm using predict.gam (mgcv package) to predict count data (y) from line
transect to a regular grid. My model have this form:
y=offset(log(x1*0.6))+s(x2)+s(
x3)+s(x4), family=quasipoisson,...
the offset is the area covered by a portion of a transect line
(length(x1)*observation distanc
On 13.08.2012 12:12, maxbre wrote:
given this example
library(corrgram)
corrgram(mtcars[2:6], order=TRUE, upper.panel=panel.conf,
lower.panel=panel.pie,
diag.panel=panel.minmax,
text.panel=panel.txt)
I's just try the "labels" arguemnt and pass the labels ther
Yes, Jessica, the practice -- of which I also have been and continue
to be guilty -- does not really make a lot of sense. It usually
doesn't affect estimation all that much, but it can certainly mess up
inference. The proper approach is to use the proper approach: model it
as left-censored data. Th
Is there any R function to fit ARCH and GARCH models for univariate time series
and to select the best model?
Sajeeka Nanayakkara
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/
Dear all
I am trying to build a package, and get the error message: ""packaging into
.tar.gz failed"".
I have also installed the same package directly from a locally created zip
file. In this case, the package is put correctly under C:\R\R-2.15.0\library.
However, when I check the package, I ge
Also, since there apparently were warnings, how about adding them?
On 13.08.2012, at 16:34, peter dalgaard wrote:
>
> On Aug 13, 2012, at 15:38 , Jennifer Kaiser wrote:
>
>>> Model: poisson, link: log
>>>
>>> Response: sb_ek_ber
>>>
>>> Terms added sequentially (first to last)
>>>
>>>
>>>
On Aug 13, 2012, at 15:38 , Jennifer Kaiser wrote:
> > Model: poisson, link: log
> >
> > Response: sb_ek_ber
> >
> > Terms added sequentially (first to last)
> >
> >
> > Df Deviance Resid. Df Resid. Dev Pr(>Chi)
> > NULL1237837 4.4998e+10
> > A
You are treating add1 as a vector of characters. If you want the zipcode and
you know what positions it is within the string use
substr(add1[1], 32, 36)
If you don't know, you could use (but it will get any 5 digit number):
regmatches(add1, regexpr("[[:digit:]]{5}", add1))
-
Beautiful, David. thanks so much!
I packaged this as a function, html2latin1(), with this simple test
> grep("&", author$givennames, value=TRUE)
[1] "Adolphe d'" "Émile"
[3] "Louis Jacques Mandé" "René"
[5] "André Michel" "Léon"
[7] "Émile" "Maurice d'"
[9] "Louis Ézéchiel"
Hello,
Not sure if I understand your required output.
Try this:
subset(df,!is.na(match(Reference,Reference[duplicated(Reference)])))
# Publication Reference Id
#1 1 a 1
#2 2 b 2
#3 3 c 3
#4 1 a 4
#7 2 b
Dear all,
I am basically a GIS user and am new to R.
I am trying to write a data frame to a dbf file.
*n.simulations <- 999
binomial <- kulldorff(geo, cases, population, NULL, pop.upper.bound,
n.simulations, alpha.level, plot)
cluster <- binomial$most.likely.cluster$location.IDs.included
df <- d
Thank you for the quick response.
But I want those duplicated with Ids in a separate vector like Duplicated.ids
in the below example?
Duplication should be checked for Publication and Reference combination, not on
a single variable.
Regards
Rayalu
-Original Message-
From: Jim Lemon [mai
given this example
library(corrgram)
corrgram(mtcars[2:6], order=TRUE, upper.panel=panel.conf,
lower.panel=panel.pie,
diag.panel=panel.minmax,
text.panel=panel.txt)
how can I change the variable names in main diagonal?
(so that I can put more informative names
On 08/13/2012 07:17 PM, Sri krishna Devarayalu Balanagu wrote:
In this following example Id 4 is duplicated with Id 1.
Like this I want both Ids (Duplicated and Duplicated with). Can anyone help?
df<- data.frame(
"Publication" = c(1, 2, 3, 1, 4, 5, 2, 3),
"Reference" = c("a", "b", "
In this following example Id 4 is duplicated with Id 1.
Like this I want both Ids (Duplicated and Duplicated with). Can anyone help?
df <- data.frame(
"Publication" = c(1, 2, 3, 1, 4, 5, 2, 3),
"Reference" = c("a", "b", "c", "a", "d", "e", "b", "c"),
"Id"= c(1, 2, 3, 4, 5, 6, 7, 8)
Tempting a use of let me google that for you..
Anyway, theres a package called Imputation. I myself used the zoo package.
There are probably lots of others since its a real common problem.
They usually fill in places in you data that are designated as NA.
I do not completely understand what yo
Hello,
I'm hoping someone with a wide experience with R may be able to see
what the program is trying to tell me.
I've got an array:
y1=rnorm(41,0.2)
y2=rnorm(41,0.2)
y3=rbind(y1,y2)
data11<-array(0,c(41,2,2))
data11[,1,]=y3
data11[,2,]=y3
rownames(data11)<-rownames(data11, do.NULL = FALSE, p
Hi Phil,
I really have to concur with Uwe Ligges here. You probably want to wrap
everything in a function. Because usually this is where long lines of
code will end up.
The browser() function makes this option really useful, as you can step
inside the temporary environment and work from ther
Hi there,
I have subscribed to R-help but am not sure how to view or post questions? I
think this is the right way.
I am planning on doing a multivariate regression investigating the relationship
between depression (a continuous variable) and social support variables (mostly
continuous, some c
It seems to me that the "recode()" function from the "car" package
is what you need.
cheers,
Rolf Turner
On 13/08/12 13:07, Sachinthaka Abeywardana wrote:
The thing is I have about 10 cases. I saw the ifelse statement but was
wondering if there was a cleaner method of doing it. Th
HI,
Much better solution:
library(car)
set.seed(1)
dat2<-data.frame(col1=c(sample(c("high","Neutral","low"),10,replace=TRUE)),col2=rep(NA,10))
x<-dat2$col1
dat2$col2<-recode(x,'"high"="H";"Neutral"="N";"low"="L"')
dat2
# col1 col2
#1 high H
#2 Neutral N
#3 Neutral N
#4
HI,
Try this:
add11<-strsplit(add1,split=",")
gsub("TX","",add11[[1]][3])
#[1] " 77076"
A.K.
- Original Message -
From: Erin Hodgess
To: R help
Cc:
Sent: Sunday, August 12, 2012 11:33 PM
Subject: [R] named character question
Dear R People:
Here is a goofy question:
I want to e
Hi,
Try this,
set.seed(1)
dat2<-data.frame(col1=c(sample(c("high","Neutral","low"),10,replace=TRUE)),col2=rep(NA,10))
dat2$col2[dat2$col1=="high"]<-"H"
dat2$col2[dat2$col1=="Neutral"]<-"N"
dat2$col2[dat2$col1=="low"]<-"L"
dat2
# col1 col2
#1 high H
#2 Neutral N
#3 Neutral
On Aug 12, 2012, at 8:33 PM, Erin Hodgess wrote:
Dear R People:
Here is a goofy question:
I want to extract the zip code from an address and here is my work
so far:
add1
results.formatted_address
"200 W Rosamond St, Houston, TX 77076, USA"
add1[1][32:36]
NA NA
88 matches
Mail list logo