__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible c
I have R packages I want to use.
Q. What is the "best" way to get to a point where all of the packages
are installed and "ready to use", AND where I only install or
re-install a package if doing so is needed?
#I searched the web for insights and found these:
https://hohenfeld.is/posts/check-if-a-
aracter vector should look like
>
> c("[", "packages_i_want_to_use", "1")
>
> You can try this yourself with quote(packages_i_want_to_use[1]) which returns
> its first argument, unevaluated.
>
> On Mon, Oct 24, 2022, 12:46 Kelly Thompson wrote:
(), similarly to library(), does not evaluate its first argument
> UNLESS you add character.only = TRUE
>
> require( packages_i_want_to_use[1], character.only = TRUE)
>
>
> On Mon, Oct 24, 2022, 12:26 Kelly Thompson wrote:
>>
>> # Below, when using require(), why do I get
# Below, when using require(), why do I get the error message "Error
in if (!loaded) { : the condition has length > 1" ?
# This is my reproducible code:
#create a vector with the names of the packages I want to use
packages_i_want_to_use <- c('base', 'this_pac_does_not_exist')
# Here I get error
562 79475 95282
> 1997 13601 NA 134757 12398NA
> 1998 30537 51117 31333 20204NA
> 1999 39240 87845 62479NA 98804
>
> If this is not what you wanted, you may need to explain further or
> await a response from someone more insightful than I.
>
> Cheers,
> Ber
As my end result, I want a matrix or data frame, with one row for each
year, and one column for each category.
On Fri, Oct 21, 2022 at 6:23 PM Kelly Thompson wrote:
>
> # I think this might be a better example.
>
> # I have data presented in a "vertical" dataf
(data_expanded)
mat <- matrix(data = data_expanded$sum_of_sales, nrow =
length(unique(data_expanded$year)), ncol =
length(unique(data_expanded$category)) , byrow = TRUE, dimnames =
list( unique(data_expanded$year), unique(data_expanded$category) ) )
data_original
data_expanded
mat
On Fri, Oct 21, 202
###
#I have data presented in a "vertical" data frame as shown below in
data_original.
#I want this data in a matrix or "grid", as shown below.
#What I show below seems like one way this can be done.
#My question: Are there easier or better ways to do this, especially
in Base R, and also in R pack
I am interested in this topic and found this post on StackOverflow,
https://stackoverflow.com/questions/44853322/how-to-read-the-contents-of-an-sql-file-into-an-r-script-to-run-a-query
This response seems especially useful,
https://stackoverflow.com/a/44886192/10816734
I'm curious about the thoug
2 at 5:32 AM Rui Barradas wrote:
>
> Hello,
>
> Another option is ?by.
>
>
> by(my_df[-1], my_df$my_category, cor)
> by(my_df[-1], my_df$my_category, \(x) cor(x)[1,2])
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 02:26 de 09/04/2022, Kelly Thompson escrev
I noticed that I get different results when subsetting using subset,
compared to subsetting using "brackets" when the subset criteria have
NA's.
Here's an example
#START OF EXAMPLE
my_data <- 1:5
my_data
my_subset_criteria <- c( F, F, T, NA, NA)
my_subset_criteria
#subsetting using subset retu
I’d like to take numeric data, and calculate numeric “quintiles” with
integer values in from 1 – 5 , with values in the lowest 20% of values
having a value of 1, the >20 - <= 40% of values having a value of 2,
the >40% - <=60% of values having a value of 3, etc.
How can I use quantcut, or another
13 matches
Mail list logo