Learn R Programming

topolow (version 1.0.0)

log_transform_parameters: Log Transform Parameter Samples

Description

Reads samples from a CSV file and log transforms specific parameters (N, k0, cooling_rate, c_repulsion) if they exist in the data. If output_file is specified, the transformed data is saved. Otherwise, the transformed data frame is returned.

Usage

log_transform_parameters(samples_file, output_file = NULL)

Value

A data.frame with log-transformed parameters. If output_file is specified, the function also writes the data frame to the specified path and returns it invisibly.

Arguments

samples_file

Character. Path to CSV file containing samples.

output_file

Character. Optional path (including filename) for saving transformed data as a CSV. If NULL (the default), the function returns the transformed data frame without writing a file.

Examples

Run this code
# This example uses a sample file included with the package.
sample_file <- system.file("extdata", "sample_params.csv", package = "topolow")

# Ensure the file exists before running the example
if (nzchar(sample_file)) {
  # Transform the data from the sample file and return as a data frame
  transformed_data <- log_transform_parameters(sample_file, output_file = NULL)
  
  # Display the first few rows of the transformed data
  print(head(transformed_data))
}

Run the code above in your browser using DataLab