I trust the escapes to do what they are designed to do. Cat the pattern to the
console if you don't.
On July 7, 2021 10:36:43 PM PDT, Greg Minshall wrote:
>> sub( "\\.[^.]*$", "", fname )
>
>fwiw, i almost always use '[.]' in preference to '.', as it
>seems to be more likely to get throu
> sub( "\\.[^.]*$", "", fname )
fwiw, i almost always use '[.]' in preference to '.', as it
seems to be more likely to get through the various levels of quoting in
different contexts.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and mo
Thanks to Ivan Krylov, David Winsemius and Duncan Murdoch for their
informative replies to my cri de coeur. The most complete answer was
however provided off-list by Andrew Simmons who wrote a new and
carefully structured function plotASCII() to replace my old no-longer
functioning plot_ascii() f
sub( "\\.[^.]*$", "", fname )
On July 7, 2021 6:27:48 PM PDT, Kai Yang via R-help
wrote:
> Hello List,
>I have a one column data frame to store file name with extension. I
>want to create new column to keep file name only without extension.
>I tried to use strsplit("name1.csv", "\\.")[[1]] to d
On Thu, 8 Jul 2021 01:27:48 + (UTC)
Kai Yang via R-help wrote:
> Hello List,
> I have a one column data frame to store file name with extension. I
> want to create new column to keep file name only without extension. I
> tried to use strsplit("name1.csv", "\\.")[[1]] to do that, but it
> j
You would need to loop through the list to use strsplit() -- you are
confused about list structure.
Here's a simple way to do it using regex's -- **assuming that there is
only one period in your names that delineates the extension.** If this
is not true, then this **will fail**. This is vectorized
Hello,
I would suggest something like `tools::file_path_sans_ext` instead of
`strsplit` to remove the file extension. This is also vectorized, so you
won't have to use a `sapply` or `vapply` on it. I hope this helps!
On Wed, Jul 7, 2021 at 9:28 PM Kai Yang via R-help
wrote:
> Hello List,
> I
Hello List,
I have a one column data frame to store file name with extension. I want to
create new column to keep file name only without extension.
I tried to use strsplit("name1.csv", "\\.")[[1]] to do that, but it just retain
the first row only and it is a vector. how can do this for all of
Hello,
I can't provide too much help without knowing which packages `hotspot` and
`levelplot` come from. It might be something as simple as
`as.data.frame(matrixaa)` instead of `matrixaa`.
On Wed, Jul 7, 2021 at 10:04 AM Ahmed Elbeltagi
wrote:
> Dear,
> I have a problem in the last co
Dear all,
Can I ask something about programming in marginal distribution for spatial
extreme?
I really stuck on my coding to obtain the parameter estimation for
univariate or marginal distribution for new model in spatial extreme.
I want to run my data in order to get the parameter estimation val
Figured it out on my own. Basically, use the replicate command for each
line of the data.frame, then appending to a file.
On 7/6/2021 9:27 AM, Evan Cooch wrote:
Suppose I have a file with the the following structure - call the two
space-separated fields 'label' and 'count':
ABC 3
DDG 5
ABB 2
And just for the fun of it, a tidverse way. I quite like uncount()
### get the library
library(tidyverse) # or just library(tidyr)
### create data as per nice base R e.g.
x <- data.frame(label = c("ABC","DDG","ABB"), count = c(3,5,2))
### use uncount to ... well, uncount it!
uncount(x, count) ->
Hello,
Sorry, I forgot the output to file part.
y <- rep(df1[[1]], df1[[2]])
cat(y, file = "~/tmp/rhelp.txt", sep = "\n")
Hope this helps,
Rui Barradas
Às 09:01 de 07/07/21, Rui Barradas escreveu:
Hello,
Use ?rep.
Since you say you have a file, in the code below I will read the data
from
Hello,
Use ?rep.
Since you say you have a file, in the code below I will read the data
from a connection. Then create the string.
txtfile <- "ABC 3
DDG 5
ABB 2"
tc <- textConnection(txtfile)
df1 <- read.table(tc)
close(tc)
rep(df1[[1]], df1[[2]])
#[1] "ABC" "ABC" "ABC" "DDG" "DDG" "DDG" "DD
much nicer
On Wed, Jul 7, 2021 at 10:58 AM Ivan Krylov wrote:
> On Tue, 6 Jul 2021 09:27:20 -0400
> Evan Cooch wrote:
>
> > I was wondering if there was an elegant/simple way to do this?
>
> rep(label, times = count) should give you a character vector with the
> answer ready for writeLines().
>
On Tue, 6 Jul 2021 09:27:20 -0400
Evan Cooch wrote:
> I was wondering if there was an elegant/simple way to do this?
rep(label, times = count) should give you a character vector with the
answer ready for writeLines().
--
Best regards,
Ivan
__
R-help
Hi Evan,
I assume you know how to get the data into a data frame (e.g. via read.csv).
Here I will create the example data explicitly, creating a data frame x.
x <- data.frame( label=c("ABC","DDG","ABB"), count=c(3,5,2) )
Then create a character vector with the data as you want it.
y <- unlist(sa
Suppose I have a file with the the following structure - call the two
space-separated fields 'label' and 'count':
ABC 3
DDG 5
ABB 2
What I need to do is parse each line of the file, and then depending on
the value of count, write out the value of 'label' to a new file, but
'count' times. In
18 matches
Mail list logo