Displaying 20 results from an estimated 30000 matches similar to: "problem with pattern matching"
2009 Aug 06
2
Re move all punctuations except commas
Dear all,
I wanted to remove all punctuations except commas from a string.
I used:
gsub("[[:punct:]]", "", string)
but I don't know how to exclude the commas ",". Anyone would kindly answer
my basic question?
--
View this message in context: http://www.nabble.com/Remove-all-punctuations-except-commas-tp24845721p24845721.html
Sent from the R help mailing list
2009 Aug 06
1
problem with recording numeric output into another dataframe
dear all,
I have two dataframes
dataframe1
ID
a
b
c
dataframe2
ID value
a;W 100
X;c 200
Y;Z 300
I wanted to match the IDs from the two dataframes and record the values into
a new column of dataframe1 at the corresponding rows. This is what I expect:
dataframe1
ID value
a 100
b
c 200
I tried doing it like this:
for (i in seq(1:nrow(dataframe1))) {
2009 Oct 13
1
vis.gam() contour plots
Greetings,
I have what I hope is a simple question. I would like to change my
contour interval on the vis.gam( plot.type="contour") in the mgcv
package. Is this a situation where I need to modify the function or is
there a default value I can change?
Thanks
2009 Jul 23
2
rows missing after dataset loaded to R
Dear all,
When I loaded a dataset (a txt file), which is structured in a tabular
format, to R by using read.delim, I found some rows were missing. The column
number was correct. These missing rows are no apparently different from the
other rows, and for some unknown reasons these missing rows scattered among
the last 50 rows of the dataset. Then after I tried to open this txt file in
Excel and
2009 Dec 09
4
equivalent of ifelse
Hi,
Is there any equivalent for ifelse (except if (cond) expr1 else expr2) which takes an atomic element as argument but returns vector since ifelse returns an object of the same length as its argument?
x = c(1,2,3)
y = c(4,5,6,7)
z = 3
ifelse(z <= 3,x,y)
would return x and not 1
thanks
2009 Aug 19
2
mild and extreme outliers in boxplot
dear all,
could somebody tell me how I can plot mild outliers as a circle(?) and
extreme outliers as an asterisk(*) in a box-whisker plot?
Thanks very much in advance
--
View this message in context: http://www.nabble.com/mild-and-extreme-outliers-in-boxplot-tp25040545p25040545.html
Sent from the R help mailing list archive at Nabble.com.
2010 Jan 03
1
calculations on columns with partially matching names
Is there a command for partial matching of character strings? Specifically,
I'd like to be able to calculate the mean of the values in any columns in a
data frame or matrix that have identity in part of their column names. For
example, columns labeled "mpw06a" and "mpw06b" match on the first five
characters; their mean would be taken whereas any columns beginning with
2004 Aug 31
3
pattern matching problems
this is from my extensions.conf, the first three patterns are for
toll-free numbers, and fourth pattern is for other numbers, where an AGI
is called for authentication.
now when I dial 011448000664327 if falls into the fourth pattern, where
as it should be matched by the first pattern. Any suggestions
1 - exten => _01144800XXXXXXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
2 - exten =>
2009 Nov 23
2
categorisation of continuous variables in R
Dear all,
I'm looking for a function comparable to switch, to categorize a
continuous variable in a few levels. Off course that can be done with
a series of ifelse statements, but that looks rather clumsy. I looked
at switch, but couldn't figure out how to use it for this. I guess
that's not possible, as it only works with characters or integers, not
with intervals.
Basically,
2009 Nov 02
3
partial matching with grep()
dear all,
This is a probably a silly question.
If I type
> grep("x",c("a.x" ,"b.x","a.xx"),value=TRUE)
[1] "a.x" "b.x" "a.xx"
Instead, I would like to obtain only
"a.x" "b.x"
How is it possible to get this result with grep()?
many thanks for your attention,
best,
vito
--
2009 Dec 02
2
Error when running Conditional Logit Model
Dear R-helpers,
I am very new to R and trying to run the conditional logit model using
"clogit " command.
I have more than 4000 observations in my dataset and try to predict the
dependent variable from 14 independent variables. My command is as follows
clmtest1 <-
clogit(Pin~Income+Bus+Pop+Urbpro+Health+Student+Grad+NE+NW+NCC+SCC+CH+SE+MRD+strata(IDD),data=clmdata)
However, it
2009 Aug 24
3
help with recalling data points in a specific region of the plot
Hi all,
Is there a quick way to display or recall data points from a specific region
on the plot? For example I want the points from x>5 and y>5?
Thank you very much!
--
Edward Chen
[[alternative HTML version deleted]]
2010 Feb 01
6
Import fixed-format ascii file with mixed record types
I need to import several ascii files in fixed format with two different record types. The data comes from European Labor Force Surveys, wich is a household survey. The first record type is for people over 16 years, and the second much sorter is for people aged 15 or less (this record has a filler with several blanks to get the same record length).
The files tipically have 160000 records, with 176
2009 Jun 17
1
function to determine to which class/category a value belongs to?
Hi all,
I''ve got a simple contingency table produced with table(), and the upper and
lower quartiles (quantile25 and quantile75) for the same dataset.
Is there a function that tells me in which category does the value of the
quartile falls into?
for example:
tabsp <- table(fam$I[fam$I>0])
1 3 6
6 1 1
and for the cumulative frequency distribution
tabcum <- cumsum(tabsp)
1 3
2009 Nov 27
2
matching and extracting data
Dear all,
I have querry on how to extract the data by matching between two data set where one has the same elements multiple times?
For example, I have two matrix X and Y.
> X
[,1] [,2] [,3]
1 A 5 P
2 B 6 P
3 C 7 P
4 D 5 Q
5 E 6 Q
6 F 7 Q
7 G 5 R
8 H 6 R
9 I 7
2009 Apr 25
4
dotplot: labeling coordinates for each point
Hi all,
I used dotplot to draw a graph for a dataset with size of 100. Since the
x-axis are all texts, so they are mixed up and not readable. Is there any
way to make it readable or how can I add labels to all the points with its
(x,y) coordinates? Thanks for your help.
Best,
Tony
[[alternative HTML version deleted]]
2009 Mar 20
2
plotting two variables with a third used for color
I have a problem where I have two columns of data that I can simply plot using:
plot(wV[0:15,3],wY[0:15,3]).
This produces my desired plot.
Now, say I have a third variable that I would like to introduce and use that variable to set different colors in the plot
In this case, say I wanted values greater than 0 to be "blue" and values less than 0 to be "red"
Basically, my
2009 Oct 03
3
else if statement error
Hello,
I am doing a simple if else statement in R. But it always comes out error
such as 'unexpected error'
There are two variables. ini and b. when ini=1, a=3; when ini>1 and b>2,
a=5; all other situations, a=6. I don't know where it is wrong.
Here is my code
ini=3
b=4
if (ini==1) {
a=3
}
else if (ini>1 and b>2 ) {
a=5
}
else {a=6}
Thanks a
2009 Nov 27
2
If condition using accessors
Hi,
I'm quite new using R and have got no one to help me get through it.
Hopefully someone can help me with one problem I've been struggling with
for the last hours!!
(Sorry if I'm using the wrong terminology as well!)
I have a data matrix in which SIE is one of my variables. What I need to
do now is to create a new variable (group) if a certain condition in SIE
is met.
I tried:
2011 Mar 21
5
Stucked with as.numeric function
Hi list,
I have problems with the as.numeric function. I have imported probabilities from external data, but they are classified as factors as str() shows. Therefore my goal is to convert the colum from factor to numeric level with keeping the decimals.
I have googled the problem for a while now and kept to several advices like