Displaying 20 results from an estimated 20000 matches similar to: "Converting a Vector into a 2-level Factor"
2007 Nov 28
1
ifelse function
Hi there,
I need help with IFELSE function.
The column g of my dataset pth, pth$g consists of "aa", "ao", "dcl", "iy",
"sh".
The last few values of pth$g looks like:
[4496] sh ao ao sh iy dcl dcl aa iy iy aa sh ao ao
Levels: aa ao dcl iy sh
I want to convert these values into 1,2,3,4,5. I tried to use a loop and I
found the following
2010 Jul 29
1
Displaying Counts of Unused Factors in Contingency Tables with table()
R-philes,
I have a question about displaying counts of unused factors using the
table() function. I have two vectors with character data in them:
local.labels("ah", "ah", "ah~")
local.preds("ah", "ah", "ah")
If I use the table function as shown below, I get an error because the
number of levels do not match up.
v.cont.table <-
2009 Dec 09
1
Exporting Contingency Tables with xtable
Dear R-philes:
I am having an issue with exporting contingency tables with xtable().
I set up a contingency and convert it to a matrix for passing to
xtable() as shown below.
v.cont.table <- table(v_lda$class, grps,
dnn=c("predicted", "observed"))
v.cont.mat <- as.matrix(v.cont.table)
Both produce output as follows:
observed
predicted uh uh~
uh 201
2008 Feb 03
4
Extract vowels and consonants using Ruby Regex
Hello,
I am trying to build a regex to extract vowels and consonants from a
string. So far, I am able to extract the basic a-e-i-o-u sequence
using the following extension to the String class:
class String
def vowels
scan(/[aeiou]/i)
end
def consonants
scan(/[^aeiou]/i)
end
end
examples:
>> "Mary had a little lamb".vowels
=> aaaiea
>> "Mary had a
2011 Jun 09
2
Coercing Output from mget() into Proper Data Frame
Hello R-philes:
I have the following function that gets the output of mget() and
converts it to a data frame to return. What I am finding is that the
dimensions are wrong. Basically, I get:
bridesmaid wed u see m gt lt like love X.0 dress pagetrack one go X3 get
1 56 35 27 30 24 20 20 23 28 17 25 16 16 28 15 26
Instead, I want something like:
[1] bridesmaid
2005 Jul 08
2
removing factor level represented by less than x rows
In a number of different situations I'm trying to
remove factor levels that are represented by less than
a certain number of rows, e.g. if I had the dataset aa
below and wanted to remove the species that are
represented in less than 2 rows:
data(iris)
aa <- iris[1:101,]
In this case, since I can see that the species
virginica only has one row, I can write:
table(aa$Species)
setosa
2001 Sep 24
1
need help creating means table
Hello,
I have been trying to use by to create a means table, but receive the
error " by(xx, list(subjs, cons, vowels), mean)
Error in Summary.data.frame(..., na.rm = na.rm) :
only defined on a data frame with all numeric or complex
variables" when the data frame consists of three factor columns (subjs,
cons and vowels) and 5 numeric data columns.
The output I'm looking for is a
2012 Mar 03
3
Using ddply within a function by argument transfer
An embedded and charset-unspecified text was scrubbed...
Name: inte tillg?nglig
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120303/a62e41f2/attachment.pl>
2001 Jan 07
2
A Top Level README for the nightly CVS snapshot
I ran into a dependency problem while compiling the CVS snapshot which
did not occur while compiling the beta 3 tarballs. For some missing
resources, autogen.sh echoes very helpful messages (such as if automake
is not present), but there was no indication that the kdelibs-devel
package was required for ao (in order to get artsc.h into /usr/include -
I'm sure it is possible to edit the
2024 Mar 01
1
gsub issue with consecutive pattern finds
Here's another *incorrect* way to do it -- incorrect because it will
not always work, unlike Iris's correct solution. But it does not
require PERL type matching. The idea: separate the two vowels in the
regex by a character that you know cannot appear (if there is such)
and match it optionally, e.g. with '*" repetition specifier. I used
"?" for the optional character
2024 Mar 01
1
gsub issue with consecutive pattern finds
Hi Iris,
Thank you. Further, very nice solution.
Best,
Iago
On 01/03/2024 12:49, Iris Simmons wrote:
> Hi Iago,
>
>
> This is not a bug. It is expected. Patterns may not overlap. However, there
> is a way to get the result you want using perl:
>
> ```R
> gsub("([aeiouAEIOU])(?=[aeiouAEIOU])", "\\1_", "aerioue", perl = TRUE)
> ```
>
2009 Aug 12
1
inserting into data frame gives "invalid factor level, NAs generated"
I am calculating some values that I am inserting into a data frame. From
what I have read, creating the dataframe ahead of time is more efficient,
since rbind (so far the only solution I have found to appending to a data
frame) is not very fast.
What I am doing is the following:
# create data frame
goframe = data.frame(goA = character(10), goB = character(10), value =
numeric(10))
goframe[1,] =
2008 Feb 20
2
spelling with <g>?
Hello,
What should the following input produce?
Dutch has shifted Germanic g to the velar fricatives [?] and [x], but
retained the spelling with <g> and thus at least a visual similarity
to German; English and Frisian have shifted g to [j] before palatal
vowels
The Dingus says:
<p>Dutch has shifted Germanic g to the velar fricatives [?] and [x],
but retained the spelling
2024 Mar 01
1
gsub issue with consecutive pattern finds
Hi all,
I tested next command:
gsub("([aeiouAEIOU])([aeiouAEIOU])", "\\1_\\2", "aerioue")
with the following output:
[1] "a_eri_ou_e"
So, there are two consecutive vowels where an underscore is not added.
May it be a bug? Is it expected (bug or not)? Is there any chance to get
what I want (an underscore between each pair of consecutive vowels)?
2024 Mar 01
1
gsub issue with consecutive pattern finds
Hi Iago,
This is not a bug. It is expected. Patterns may not overlap. However, there
is a way to get the result you want using perl:
```R
gsub("([aeiouAEIOU])(?=[aeiouAEIOU])", "\\1_", "aerioue", perl = TRUE)
```
The specific change I made is called a positive lookahead, you can read
more about it here:
https://www.regular-expressions.info/lookaround.html
2008 Sep 25
1
Repeated factor levels - inconsistency of factor and levels<- functions?
Hello,
I have a vector x containing letters ("a", "b" etc.). Now I want to
convert it to factor and group some letters into one common level. If I do
it by factor function, giving the same label names for all values I want
to group, it doesn't work:
> x<-letters[1:5]
> x
[1] "a" "b" "c" "d" "e"
>
2008 Apr 15
2
a question of alphabetical order
Hi all,
In Spanish vowels with accent like ?, ?, ... doesn't affect to the
alphabetical order of vector of strings. I mean, a or ? don't matter for
establishing the alphabetical order.
Nevertheless, while working with R order, here is what I get.
Given a file transport.txt
medio#variable
avi?n#34
barco#33
bicicleta#3
?ngulo#37
cami?n#54
coche#23
tren#67
> toPlot <-
2000 Oct 01
4
CVS Problem
I've been kind of busy lately, but I wanted to see what's up with ao after the
build change. I was able to check out the vorbis module, but when I tried to
check out the ao module I saw this:
[stan@volsung vorbis]$ cvs -d:pserver:anoncvs@cvs.xiph.org:/usr/local/cvsroot
co -r branch_postbeta2 ao
cvs server: Updating ao
cvs server: Updating ao/doc
cvs server: Updating ao/include
cvs
2011 May 19
1
IDWT - Inverse Discrete Wavelet Transform
Hello,
I am not expert in wavelet.
i am working with a discrete dataset in 3D. I applied the D4 wavelet
transform to each dimension sequentially. I made some analysis in the
transformed space and i detected some interesting vowel.
My question is. How is it possible to map a 3d coordinate in the transformed
space to the related coordinate in the 3d original dataset? (i think that
probably one
2010 Jan 25
1
PCA: Showing file datalabels on biplot
The script below successfully produces a biplot of the data but the 'site
names' (rows) and the names of the 'response variables' (columns) are shown
as simple numerals (rather than the column and row names). How might I
'enforce' the use of the row/column names used in the datafile (section of
datafile shown below)?
Can anyone help, please?
Section of datafile
sample a b